#937 Install egginfo for python-koji rpms
Closed 2 years ago by tkopecek. Opened 5 years ago by tkopecek.
tkopecek/koji issue912  into  master

file modified
+22
@@ -62,6 +62,8 @@ 

  %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

  %{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}}

  %{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}

+ %{!?py2_eggversion: %global py2_eggversion %(%{__python2} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}

+ %{!?py3_eggversion: %global py3_eggversion %(%{__python3} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}

  

  # If the definition isn't available for python3_pkgversion, define it

  %{?!python3_pkgversion:%global python3_pkgversion 3}
@@ -115,8 +117,10 @@ 

  %{?python_provide:%python_provide python2-%{name}}

  %if 0%{?fedora} >= 30

  BuildRequires: python2-devel

+ BuildRequires: python2-setuptools

  %else

  BuildRequires: python-devel

+ BuildRequires: python%{python3_pkgversion}-setuptools

  %endif

  %if 0%{?fedora} || 0%{?rhel} >= 8

  Requires: python2-rpm
@@ -377,6 +381,14 @@ 

  %autosetup -p1

  

  %build

+ %if 0%{py2_support}

+ mkdir -p py2_egg

+ %{__python2} setup.py egg_info --egg-base py2_egg

+ %endif

+ %if 0%{py3_support}

+ mkdir -p py3_egg

+ %{__python3} setup.py egg_info --egg-base py3_egg

+ %endif

  

  %install

  rm -rf $RPM_BUILD_ROOT
@@ -398,6 +410,10 @@ 

  done

  %endif

  %endif

+ %if 0%{py2_support}

+ mkdir -p $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info

+ install -p -m 644 py2_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info

+ %endif

  

  

  # python3 build
@@ -422,6 +438,10 @@ 

  sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT/usr/bin/koji

  %endif

  %endif

+ %if 0%{py3_support}

+ mkdir -p $RPM_BUILD_ROOT%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info

+ install -p -m 644 py3_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info

+ %endif

  

  %if 0%{?fedora}

  # handle extra byte compilation
@@ -474,12 +494,14 @@ 

  %files -n python2-%{name}

  %{python2_sitearch}/%{name}

  %{python2_sitearch}/koji_cli

+ %{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info

  %endif

  

  %if 0%{py3_support}

  %files -n python%{python3_pkgversion}-koji

  %{python3_sitearch}/%{name}

  %{python3_sitearch}/koji_cli

+ %{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info

  %endif

  

  %if 0%{py2_support}

I'm not sure how to properly hand that we've cli and lib in different rpms. Egginfo lists them both :-(

Put it in the cli package, since cli requires lib anyway.

Put it in the cli package, since cli requires lib anyway.

But then other packages will have to depend on the cli even if they only need the library.

That is no different than the situation now with fetching from PyPI.

We need to have it in lib rpms, as they have different egginfo for py2/3. CLI is only one rpm without differentiation.

I'm worried that this is going to require a significant refactor

@mikem you mean spec, or whole setup.py packaging?

Hi, any updates so far?

rebased onto c973565

3 years ago

It works on f31 and f33 - it doesn't work at the moment on f32, but I've not been able to find anything about the problem.

Pull-Request has been closed by tkopecek

2 years ago