#4 Use wheels from RPM packages
Merged 5 years ago by churchyard. Opened 5 years ago by churchyard.
rpms/ churchyard/python-virtualenv rpmwheels  into  master

file modified
+79 -19
@@ -8,7 +8,7 @@ 

  

  Name:           python-virtualenv

  Version:        16.0.0

- Release:        4%{?dist}

+ Release:        5%{?dist}

  Summary:        Tool to create isolated Python environments

  

  Group:          Development/Languages
@@ -28,6 +28,9 @@ 

  # the change needs to be properly communicated with Python SIG!

  Patch1: python26.patch

  

+ # Add /usr/share/python-wheels to file_search_dirs

+ Patch2: rpm-wheels.patch

+ 

  BuildArch:      noarch

  BuildRequires:  git-core

  BuildRequires:  python2-devel
@@ -38,6 +41,11 @@ 

  BuildRequires:  python3-sphinx

  %endif # with_python3

  

+ # RPM installed wheels

+ BuildRequires:  python-pip-wheel

+ BuildRequires:  python-setuptools-wheel

+ BuildRequires:  python-wheel-wheel

+ 

  %description

  virtualenv is a tool to create isolated Python environments. virtualenv

  is a successor to workingenv, and an extension of virtual-python. It is
@@ -50,16 +58,13 @@ 

  

  Requires:       python2-setuptools

  Requires:       python2-devel

+ Requires:       (python2-virtualenv-python26 = %{version}-%{release} if python26)

  %{?python_provide:%python_provide python2-virtualenv}

  

- # bundled wheels

- Provides:       bundled(python2dist(argparse)) = 1.4.0

- Provides:       bundled(python2dist(pip)) = 9.0.3

- Provides:       bundled(python2dist(pip)) = 10.0.1

- Provides:       bundled(python2dist(setuptools)) = 36.8.0

- Provides:       bundled(python2dist(setuptools)) = 39.1.0

- Provides:       bundled(python2dist(wheel)) = 0.29.0

- Provides:       bundled(python2dist(wheel)) = 0.31.1

+ # RPM installed wheels

+ Requires:       python-pip-wheel

+ Requires:       python-setuptools-wheel

+ Requires:       python-wheel-wheel

  

  %description -n python2-virtualenv

  virtualenv is a tool to create isolated Python environments. virtualenv
@@ -68,6 +73,23 @@ 

  licensed under an MIT-style permissive license

  

  

+ %package -n     python2-virtualenv-python26

+ Summary:        Extra bits of virtuelenv only needed with Python 2.6

+ Requires:       python2-virtualenv = %{version}-%{release}

+ %{?python_provide:%python_provide python2-virtualenv-python26}

+ 

+ # bundled wheels for Python 2.6

+ Provides:       bundled(python2dist(argparse)) = 1.4.0

+ Provides:       bundled(python2dist(pip)) = 9.0.3

+ Provides:       bundled(python2dist(setuptools)) = 36.8.0

+ Provides:       bundled(python2dist(wheel)) = 0.29.0

+ 

+ %description -n python2-virtualenv-python26

+ This package contains wheels of older versions of argparse, pip, setuptools and

+ wheel that are required for virtualenv to create Python 2.6 virtual

+ environments.

+ 

+ 

  %if 0%{?with_python3}

  %package -n     python-virtualenv-doc

  Summary:        Documentation for python virtualenv
@@ -80,16 +102,13 @@ 

  

  Requires:       python3-setuptools

  Requires:       python3-devel

+ Requires:       (python3-virtualenv-python26 = %{version}-%{release} if python26)

  %{?python_provide:%python_provide python3-virtualenv}

  

- # bundled wheels

- Provides:       bundled(python3dist(argparse)) = 1.4.0

- Provides:       bundled(python3dist(pip)) = 9.0.3

- Provides:       bundled(python3dist(pip)) = 10.0.1

- Provides:       bundled(python3dist(setuptools)) = 36.8.0

- Provides:       bundled(python3dist(setuptools)) = 39.1.0

- Provides:       bundled(python3dist(wheel)) = 0.29.0

- Provides:       bundled(python3dist(wheel)) = 0.31.1

+ # RPM installed wheels

+ Requires:       python-pip-wheel

+ Requires:       python-setuptools-wheel

+ Requires:       python-wheel-wheel

  

  %description -n python3-virtualenv

  virtualenv is a tool to create isolated Python environments. virtualenv
@@ -99,10 +118,35 @@ 

  %endif # with_python3

  

  

+ %package -n     python3-virtualenv-python26

+ Summary:        Extra bits of virtuelenv only needed with Python 2.6

+ Requires:       python3-virtualenv = %{version}-%{release}

+ %{?python_provide:%python_provide python3-virtualenv-python26}

+ 

+ # bundled wheels for Python 2.6

+ Provides:       bundled(python2dist(argparse)) = 1.4.0

+ Provides:       bundled(python2dist(pip)) = 9.0.3

+ Provides:       bundled(python2dist(setuptools)) = 36.8.0

+ Provides:       bundled(python2dist(wheel)) = 0.29.0

+ 

+ %description -n python3-virtualenv-python26

+ This package contains wheels of older versions of argparse, pip, setuptools and

+ wheel that are required for virtualenv to create Python 2.6 virtual

+ environments.

+ 

  %prep

  %autosetup -p1 -S git -n virtualenv-%{version}

  %{__sed} -i -e "1s|#!/usr/bin/env python||" virtualenv.py 

  

+ # Remove the wheels provided by RPM packages

+ # Those are the "recent" version shipped with virtualenv 16.0.0

+ rm virtualenv_support/pip-10.*

+ rm virtualenv_support/setuptools-39.*

+ rm virtualenv_support/wheel-0.31.*

+ 

+ # make sure we only left what was intended (old argparse, pip, setuptools, wheel)

+ ls virtualenv_support/*.whl

+ test $(ls virtualenv_support/*.whl -1 | wc -l) -eq 4

  

  %build

  # Build code
@@ -139,11 +183,18 @@ 

  %license LICENSE.txt

  %doc docs/*rst PKG-INFO AUTHORS.txt

  

- %{python2_sitelib}/*

+ %{python2_sitelib}/virtualenv.py*

+ %dir %{python2_sitelib}/virtualenv_support/

+ %{python2_sitelib}/virtualenv_support/__init__.py*

+ %{python2_sitelib}/virtualenv-*.egg-info/

  %{_bindir}/virtualenv

  %{_bindir}/virtualenv-2

  %{_bindir}/virtualenv-%{python2_version}

  

+ %files  -n python2-virtualenv-python26

+ %{python2_sitelib}/virtualenv_support/*.whl

+ 

+ 

  %if 0%{?with_python3}

  # Include sphinx docs on Fedora

  %files -n python-virtualenv-doc
@@ -156,14 +207,23 @@ 

  %{_bindir}/virtualenv-3

  %{_bindir}/virtualenv-%{python3_version}

  %{python3_sitelib}/virtualenv.py

- %{python3_sitelib}/virtualenv_support/

+ %dir %{python3_sitelib}/virtualenv_support/

+ %{python3_sitelib}/virtualenv_support/__init__.py

+ %{python3_sitelib}/virtualenv_support/__pycache__/

  %{python3_sitelib}/virtualenv-*.egg-info/

  %{python3_sitelib}/__pycache__/*

+ 

+ %files  -n python3-virtualenv-python26

+ %{python3_sitelib}/virtualenv_support/*.whl

  %endif

  

  

  

  %changelog

+ * Wed Aug 15 2018 Miro Hrončok <mhroncok@redhat.com> - 16.0.0-5

+ - Use wheels from RPM packages

+ - Put wheels needed for Python 2.6 into a subpackage

+ 

  * Wed Jul 18 2018 Miro Hrončok <mhroncok@redhat.com> - 16.0.0-4

  - Reintroduce support for Python 2.6 (#1602347)

  - Add missing bundled provides

file modified
-14
@@ -100,20 +100,6 @@ 

       sys.exit(101)

   

   try:

- @@ -822,7 +822,12 @@ def find_wheels(projects, search_dirs):

-              # The pattern could be tightened to require -py2.py3-none-any.whl.

-              files = glob.glob(os.path.join(dirname, project + '-*.whl'))

-              if files:

- -                wheels.append(os.path.abspath(files[0]))

- +                # Hack for Python 2.6 and pip 9

- +                files = sorted(files)

- +                if sys.version_info[:2] == (2, 6) and project == 'pip':

- +                    wheels.append(os.path.abspath(files[-1]))

- +                else:

- +                    wheels.append(os.path.abspath(files[0]))

-                  break

-          else:

-              # We're out of luck, so quit with a suitable error

  @@ -931,13 +936,22 @@ def create_environment(home_dir, site_packages=False, clear=False,

       to_install = []

   

file added
+14
@@ -0,0 +1,14 @@ 

+ diff --git a/virtualenv.py b/virtualenv.py

+ index 2ad2695..a0ddfaf 100755

+ --- a/virtualenv.py

+ +++ b/virtualenv.py

+ @@ -400,6 +400,9 @@ def _find_file(filename, dirs):

+  def file_search_dirs():

+      here = os.path.dirname(os.path.abspath(__file__))

+      dirs = [here, join(here, 'virtualenv_support')]

+ +    if sys.version_info >= (2, 7):

+ +        # we don't insert on 2.6 because the wheels there are not compatible

+ +        dirs.insert(1, '/usr/share/python-wheels')

+      if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':

+          # Probably some boot script; just in case virtualenv is installed...

+          try:

At least for Python > 2.6

Only available at Fedora 29+.

I see a possible clash with the python26 patch, so let me change that a bit.

rebased onto 542c410521bfdf586cb0bfa4500abe7fed342325

5 years ago

This should work now, yet I'd rather test it with both 2.6 and newer Pythons.

rebased onto 34d58a7

5 years ago

Now it does work for me.

Is this comment accurate? The following section reference py3 items.

I used python3dist in python3 subpackage. One can argue we should use python2dist or even python2.6dist, yet those wheels are in fact universal and the bundled provide is only used for humans, not machines. I don't really care here, really...

Now let me try to push another commit that would even not install all the wheels if python26 is not present...

1 new commit added

  • Put wheels needed for Python 2.6 into a subpackage
5 years ago

Pull-Request has been merged by churchyard

5 years ago