#6 Add a subpackage with wheels
Merged 5 years ago by churchyard. Opened 5 years ago by pviktori.
rpms/ pviktori/python-setuptools wheels  into  master

file modified
+33 -37
@@ -5,33 +5,20 @@ 

  %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

  %if %{with python2}

- %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

+ %global python_wheeldir %{_datadir}/python-wheels

  

  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 +51,6 @@ 

  %endif # with tests

  %endif # with python2

  

- %if %{with python3}

  BuildRequires:  python3-devel

  %if %{with tests}

  BuildRequires:  python3-pip
@@ -77,7 +63,6 @@ 

  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 +95,6 @@ 

  %endif # with python2

  

  

- %if %{with python3}

  %package -n python3-setuptools

  Summary:        Easily build and distribute Python 3 packages

  Group:          Applications/System
@@ -125,7 +109,13 @@ 

  This package also contains the runtime components of setuptools, necessary to

  execute the software that requires pkg_resources.py.

  

- %endif # with python3

+ %if %{without bootstrap}

+ %package wheel

+ Summary:        The setuptools wheel

+ 

+ %description wheel

+ A Python wheel of setuptools to use with venv.

+ %endif

  

  

  %prep
@@ -153,30 +143,23 @@ 

  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 %{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}

+ %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}
@@ -194,12 +177,11 @@ 

  %endif

  

  find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f

- %endif # with python3

  

  

  %if %{with python2}

  %if %{without bootstrap}

- %py2_install_wheel %{python2_wheelname}

+ %py2_install_wheel %{python_wheelname}

  %else

  %py2_install

  %endif
@@ -215,6 +197,11 @@ 

  # 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
@@ -223,12 +210,10 @@ 

  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 +226,6 @@ 

  %{_bindir}/easy_install-2.*

  %endif # with python2

  

- %if %{with python3}

  %files -n python3-setuptools

  %license LICENSE

  %doc docs/* CHANGES.rst README.rst
@@ -250,10 +234,22 @@ 

  %{python3_sitelib}/setuptools*/

  %{python3_sitelib}/__pycache__/*

  %{_bindir}/easy_install-3.*

- %endif # with python3

+ 

+ %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 <pviktori@redhat.com> - 39.2.0-7

+ - Add a subpackage with wheels

+ - Remove the python3 bcond

+ - Remove macros for RHEL 6

+ 

  * Thu Jul 19 2018 Miro Hrončok <mhroncok@redhat.com> - 39.2.0-6

  - Create /usr/local/lib/pythonX.Y when needed (#1576924)

  

  • Remove bcond for python3 to simplify the specfile
  • Remove some RHEL6 macros
  • Build a -wheel subpackage for use in venv/ensurepip

rebased onto 4d41ef0

5 years ago

Pull-Request has been merged by churchyard

5 years ago