From 4d41ef086a4daa01d2a00cd25ecaa0bfd40f62c9 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Aug 15 2018 13:43:51 +0000 Subject: [PATCH 1/2] Remove the python3 bcond There is no point of building this without python3 any more, and this makes the spec a bit more readable. Also, remove macros for RHEL 6 --- diff --git a/python-setuptools.spec b/python-setuptools.spec index ac3dd2f..255ab66 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -5,17 +5,7 @@ %bcond_with bootstrap %bcond_without tests -%if 0%{?rhel} && 0%{?rhel} <= 7 -%global _without_python3 1 -# define some macros for RHEL 6 -%global __python2 %__python -%global python2_sitelib %python_sitelib -%endif - -# Note(hguemar): overrides must be placed *before* those -# Otherwise it doesn't work %bcond_without python2 -%bcond_without python3 %if %{without bootstrap} %global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl @@ -23,15 +13,13 @@ %global python2_wheelname %python_wheelname %global python2_record %{python2_sitelib}/%{srcname}-%{version}.dist-info/RECORD %endif -%if %{with python3} %global python3_wheelname %python_wheelname %global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD %endif -%endif Name: python-setuptools Version: 39.2.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Easily build and distribute Python packages Group: Applications/System @@ -64,7 +52,6 @@ BuildRequires: python2-pytest-virtualenv %endif # with tests %endif # with python2 -%if %{with python3} BuildRequires: python3-devel %if %{with tests} BuildRequires: python3-pip @@ -77,7 +64,6 @@ BuildRequires: python3-pytest-virtualenv BuildRequires: python3-pip BuildRequires: python3-wheel %endif # without bootstrap -%endif # with python3 # We're now back to setuptools as the package. # Keep the python-distribute name active for a few releases. Eventually we'll @@ -110,7 +96,6 @@ execute the software that requires pkg_resources.py. %endif # with python2 -%if %{with python3} %package -n python3-setuptools Summary: Easily build and distribute Python 3 packages Group: Applications/System @@ -125,8 +110,6 @@ have dependencies on other packages. This package also contains the runtime components of setuptools, necessary to execute the software that requires pkg_resources.py. -%endif # with python3 - %prep %autosetup -p1 -n %{srcname}-%{version} @@ -161,20 +144,17 @@ chmod -x README.rst %endif %endif # with python2 -%if %{with python3} %if %{without bootstrap} %py3_build_wheel %else %py3_build %endif -%endif # with python3 %install # Must do the python3 install first because the scripts in /usr/bin are -# overwritten with every setup.py install (and we want the python2 version to -# be the default for now). -%if %{with python3} +# overwritten with every setup.py install (and we want /usr/bin/pip to be +# the python2 version). %if %{without bootstrap} %py3_install_wheel %{python3_wheelname} @@ -194,7 +174,6 @@ sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record} %endif find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f -%endif # with python3 %if %{with python2} @@ -223,12 +202,10 @@ rm -r docs/{Makefile,conf.py,_*} PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python2_version} %endif # with python2 -%if %{with python3} # --ignore=setuptools/tests/test_virtualenv.py: because virtualenv executable # is configured only for Python 2 version of virtualenv—this needs to be fixed # in the `python-pytest-virtualenv` package PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore=setuptools/tests/test_virtualenv.py -%endif # with python3 %endif # with tests @@ -241,7 +218,6 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore= %{_bindir}/easy_install-2.* %endif # with python2 -%if %{with python3} %files -n python3-setuptools %license LICENSE %doc docs/* CHANGES.rst README.rst @@ -250,10 +226,13 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore= %{python3_sitelib}/setuptools*/ %{python3_sitelib}/__pycache__/* %{_bindir}/easy_install-3.* -%endif # with python3 %changelog +* Wed Aug 15 2018 Petr Viktorin - 39.2.0-7 +- Remove the python3 bcond +- Remove macros for RHEL 6 + * Thu Jul 19 2018 Miro Hrončok - 39.2.0-6 - Create /usr/local/lib/pythonX.Y when needed (#1576924) From d7f5288145581041ee77d43819e7fb39e6bc8884 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Aug 15 2018 13:43:57 +0000 Subject: [PATCH 2/2] Add a subpackage with wheels Use a common python_wheelname for both Pytohn versions --- diff --git a/python-setuptools.spec b/python-setuptools.spec index 255ab66..f0dc153 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -10,12 +10,11 @@ %if %{without bootstrap} %global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl %if %{with python2} -%global python2_wheelname %python_wheelname %global python2_record %{python2_sitelib}/%{srcname}-%{version}.dist-info/RECORD %endif -%global python3_wheelname %python_wheelname %global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD %endif +%global python_wheeldir %{_datadir}/python-wheels Name: python-setuptools Version: 39.2.0 @@ -110,6 +109,14 @@ have dependencies on other packages. This package also contains the runtime components of setuptools, necessary to execute the software that requires pkg_resources.py. +%if %{without bootstrap} +%package wheel +Summary: The setuptools wheel + +%description wheel +A Python wheel of setuptools to use with venv. +%endif + %prep %autosetup -p1 -n %{srcname}-%{version} @@ -136,17 +143,13 @@ rm setuptools/tests/test_integration.py chmod -x README.rst %build -%if %{with python2} %if %{without bootstrap} -%py2_build_wheel +%py3_build_wheel %else +%if %{with python2} %py2_build -%endif %endif # with python2 -%if %{without bootstrap} -%py3_build_wheel -%else %py3_build %endif @@ -156,7 +159,7 @@ chmod -x README.rst # overwritten with every setup.py install (and we want /usr/bin/pip to be # the python2 version). %if %{without bootstrap} -%py3_install_wheel %{python3_wheelname} +%py3_install_wheel %{python_wheelname} # Remove /usr/bin/easy_install from the record as later on we delete the file sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record} @@ -178,7 +181,7 @@ find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f %if %{with python2} %if %{without bootstrap} -%py2_install_wheel %{python2_wheelname} +%py2_install_wheel %{python_wheelname} %else %py2_install %endif @@ -194,6 +197,11 @@ find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f # Don't ship these rm -r docs/{Makefile,conf.py,_*} +%if %{without bootstrap} +mkdir -p %{buildroot}%{python_wheeldir} +install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} +%endif + %if %{with tests} %check @@ -227,9 +235,18 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore= %{python3_sitelib}/__pycache__/* %{_bindir}/easy_install-3.* +%if %{without bootstrap} +%files wheel +%license LICENSE +# we own the dir for simplicity +%dir %{python_wheeldir}/ +%{python_wheeldir}/%{python_wheelname} +%endif + %changelog * Wed Aug 15 2018 Petr Viktorin - 39.2.0-7 +- Add a subpackage with wheels - Remove the python3 bcond - Remove macros for RHEL 6