python34 packages for EPEL

Orion Poplawski orion at cora.nwra.com
Wed Jul 15 22:41:13 UTC 2015


Sorry for the cross posting - let's follow up on the EPEL list

We now have python34 in EPEL (yay - thanks Matej and others!).  Starting to
look at packaging some modules.  We have
https://fedoraproject.org/wiki/User:Bkabrda/EPEL7_Python3 as a starting point
which looks pretty good.  One wrinkle though is that we have a bunch of
python2 packages provided by RHEL that we'll want to provide python3X versions
for in EPEL, but not ship python2 versions.  So a question becomes, where do
they get maintained?  Either:

- epel7 branch of the python-blah package in Fedora?
- a new python3X-blah package?

And if in an epel7 branch of an existing package, is it conceivable to
maintain a common spec across EPEL and Fedora?

I think this is somewhat representative of the changes needed in a more
complicated package (setuptools) which isn't actually too terrrible:

diff --git a/python-setuptools.spec b/python-setuptools.spec
index 7f37e90..cb96b9f 100644
--- a/python-setuptools.spec
+++ b/python-setuptools.spec
@@ -1,9 +1,9 @@
-%if 0%{?fedora}
+%if 0%{?fedora} || 0%{?rhel} >= 7
 %global with_python3 1

 # This controls whether setuptools is build as a wheel or not,
 # simplifying Python 3.4 bootstraping process
-%global build_wheel 1
+%global build_wheel 0
 %else
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from
distutils.sysconfig import get_python_lib; print (get_python_lib())")}
 %endif
@@ -44,10 +44,10 @@ BuildRequires:  python-pip
 BuildRequires:  python-wheel
 %endif
 %if 0%{?with_python3}
-BuildRequires:  python3-devel
+BuildRequires:  python%{python3_pkgversion}-devel
 %if 0%{?build_wheel}
-BuildRequires:  python3-pip
-BuildRequires:  python3-wheel
+BuildRequires:  python%{python3_pkgversion}-pip
+BuildRequires:  python%{python3_pkgversion}-wheel
 %endif
 %endif # if with_python3
 # For unittests
@@ -68,7 +68,7 @@ This package also contains the runtime components of
setuptools, necessary to
 execute the software that requires pkg_resources.py.

 %if 0%{?with_python3}
-%package -n python3-setuptools
+%package -n python%{python3_pkgversion}-setuptools
 Summary:        Easily build and distribute Python 3 packages
 Group:          Applications/System

@@ -76,7 +76,7 @@ Group:          Applications/System
 # has been present since python3-3.2.  We do not ship python3-3.0 or
 # python3-3.1 anywhere

-%description -n python3-setuptools
+%description -n python%{python3_pkgversion}-setuptools
 Setuptools is a collection of enhancements to the Python 3 distutils that allow
 you to more easily build and distribute Python 3 packages, especially ones that
 have dependencies on other packages.
@@ -156,6 +156,9 @@ chmod +x
%{buildroot}%{python3_sitelib}/setuptools/command/easy_install.py
 popd
 %endif # with_python3

+%if 0%{?epel}
+rm %{buildroot}/%{_bindir}/easy_install
+%else
 %if 0%{?build_wheel}
 pip2 install -I dist/%{python2_wheelname} --root %{buildroot}
--strip-file-prefix %{buildroot}
 %else
@@ -167,9 +170,11 @@ rm -rf %{buildroot}%{python_sitelib}/setuptools/tests
 sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
 %endif

-install -p -m 0644 %{SOURCE1} %{SOURCE2} .
 find %{buildroot}%{python_sitelib} -name '*.exe' | xargs rm -f
 chmod +x %{buildroot}%{python_sitelib}/setuptools/command/easy_install.py
+%endif # 0%{?epel}
+
+install -p -m 0644 %{SOURCE1} %{SOURCE2} .

 %check
 %{__python} setup.py test
@@ -184,15 +189,17 @@ popd
 rm -rf %{buildroot}


+%if !0%{?epel}
 %files
 %defattr(-,root,root,-)
 %doc *.txt docs
 %{python_sitelib}/*
 %{_bindir}/easy_install
 %{_bindir}/easy_install-2.*
+%endif

 %if 0%{?with_python3}
-%files -n python3-setuptools
+%files -n python%{python3_pkgversion}-setuptools
 %defattr(-,root,root,-)
 %doc psfl.txt zpl.txt docs
 %{python3_sitelib}/*


One note - according to
https://fedoraproject.org/wiki/User:Bkabrda/EPEL7_Python3#Specfiles.2C_Macros.2C_Packaging_Process
%{python3_pkgversion} is supposed to be defined in Fedora, but I don't see it
(at least not in F22). In the review
(https://bugzilla.redhat.com/show_bug.cgi?id=1219411#c8) there seems to be
some uncertainty as to where it will land?

Comments?

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion at nwra.com
Boulder, CO 80301                   http://www.nwra.com


More information about the python-devel mailing list