diff --git a/python-virtualenv.spec b/python-virtualenv.spec index 2d1d3a6..f3bd66a 100644 --- a/python-virtualenv.spec +++ b/python-virtualenv.spec @@ -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 @@ Patch0: check-exec_dir.patch # 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-devel 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 @@ -52,14 +60,16 @@ Requires: python2-setuptools Requires: python2-devel %{?python_provide:%python_provide python2-virtualenv} -# bundled wheels +# RPM installed wheels +Requires: python-pip-wheel +Requires: python-setuptools-wheel +Requires: python-wheel-wheel + +# bundled wheels for Python 2.6 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 %description -n python2-virtualenv virtualenv is a tool to create isolated Python environments. virtualenv @@ -82,14 +92,16 @@ Requires: python3-setuptools Requires: python3-devel %{?python_provide:%python_provide python3-virtualenv} -# bundled wheels +# RPM installed wheels +Requires: python-pip-wheel +Requires: python-setuptools-wheel +Requires: python-wheel-wheel + +# bundled wheels for Python 2.6 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 %description -n python3-virtualenv virtualenv is a tool to create isolated Python environments. virtualenv @@ -103,6 +115,15 @@ licensed under an MIT-style permissive license %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 @@ -164,6 +185,9 @@ cp %{buildroot}/%{_bindir}/virtualenv %{buildroot}/%{_bindir}/virtualenv-2 %changelog +* Wed Aug 15 2018 Miro Hrončok - 16.0.0-5 +- Use wheels from RPM packages + * Wed Jul 18 2018 Miro Hrončok - 16.0.0-4 - Reintroduce support for Python 2.6 (#1602347) - Add missing bundled provides diff --git a/python26.patch b/python26.patch index 956b986..00d0146 100644 --- a/python26.patch +++ b/python26.patch @@ -100,20 +100,6 @@ index cbf41de..57cb471 100755 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 = [] diff --git a/rpm-wheels.patch b/rpm-wheels.patch new file mode 100644 index 0000000..cac79da --- /dev/null +++ b/rpm-wheels.patch @@ -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: