diff --git a/SOURCES/rpm-wheels.patch b/SOURCES/rpm-wheels.patch new file mode 100644 index 0000000..6238af8 --- /dev/null +++ b/SOURCES/rpm-wheels.patch @@ -0,0 +1,24 @@ +diff --git a/virtualenv.py b/virtualenv.py +index 5699998..55c7321 100755 +--- a/virtualenv.py ++++ b/virtualenv.py +@@ -39,9 +39,9 @@ except ImportError: + __version__ = "15.1.0" + virtualenv_version = __version__ # legacy + +-if sys.version_info < (2, 6): ++if sys.version_info < (2, 7): + print('ERROR: %s' % sys.exc_info()[1]) +- print('ERROR: this script requires Python 2.6 or greater.') ++ print('ERROR: this script requires Python 2.7 or greater.') + sys.exit(101) + + try: +@@ -399,6 +399,7 @@ def _find_file(filename, dirs): + def file_search_dirs(): + here = os.path.dirname(os.path.abspath(__file__)) + dirs = [here, join(here, 'virtualenv_support')] ++ dirs.insert(1, '/usr/share/python{}-wheels'.format(sys.version_info[0])) + if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv': + # Probably some boot script; just in case virtualenv is installed... + try: diff --git a/SPECS/python-virtualenv.spec b/SPECS/python-virtualenv.spec index bf65a73..75f9256 100644 --- a/SPECS/python-virtualenv.spec +++ b/SPECS/python-virtualenv.spec @@ -7,7 +7,7 @@ Name: python-virtualenv Version: 15.1.0 -Release: 18%{?dist} +Release: 19%{?dist} Summary: Tool to create isolated Python environments Group: Development/Languages @@ -20,15 +20,35 @@ Source0: http://pypi.python.org/packages/source/v/virtualenv/virtualenv-% # listing it's content. Patch0: check-exec_dir.patch +# Add /usr/share/python{2,3}-wheels to file_search_dirs +# and fail with a warning on versions of Python < 2.7 +Patch2: rpm-wheels.patch + # Don't fail on missing certifi's cert # https://github.com/pypa/virtualenv/pull/1252 Patch3: dont-fail-on-missing-certifi-cert.patch BuildArch: noarch -%{?with_python2:BuildRequires: python2-devel} + +%if %{with python2} +BuildRequires: python2-devel +BuildRequires: python2-setuptools + +# RPM installed wheels +BuildRequires: python2-pip-wheel +BuildRequires: python2-setuptools-wheel +BuildRequires: python2-wheel-wheel +%endif # with python2 %if %{with python3} BuildRequires: python3-sphinx +BuildRequires: python3-setuptools + +# RPM installed wheels +BuildRequires: python3-pip-wheel +BuildRequires: python3-setuptools-wheel +BuildRequires: python3-wheel-wheel + %if %{with python36_module} BuildRequires: python36-devel BuildRequires: python36-rpm-macros @@ -50,6 +70,12 @@ Summary: Tool to create isolated Python environments Requires: python2-setuptools Requires: python2-devel + +# RPM installed wheels +Requires: python2-pip-wheel +Requires: python2-setuptools-wheel +Requires: python2-wheel-wheel + %{?python_provide:%python_provide python2-virtualenv} %description -n python2-virtualenv @@ -71,6 +97,12 @@ Documentation for python virtualenv. Summary: Tool to create isolated Python environments Requires: python3-setuptools + +# RPM installed wheels +Requires: python3-pip-wheel +Requires: python3-setuptools-wheel +Requires: python3-wheel-wheel + # For alternatives Requires: python36 Requires(post): python36 @@ -96,8 +128,15 @@ licensed under an MIT-style permissive license %{__sed} -i -e "1s|#!/usr/bin/env python||" virtualenv.py %patch0 -p1 +%patch2 -p1 %patch3 -p1 +# Remove the wheels provided by RPM packages and argparse as it's only required for python 2.6 +rm virtualenv_support/pip-* +rm virtualenv_support/setuptools-* +rm virtualenv_support/wheel-* +rm virtualenv_support/argparse-* + %build # Build code %{?with_python2:%{py2_build}} @@ -187,6 +226,10 @@ fi %changelog +* Fri Jun 21 2019 Miro HronĨok - 15.1.0-19 +- Use wheels from RPM packages (rhbz#1659550) (rhbz#1659551) +- Fail with a warning on Python versions < 2.7 + * Thu Apr 25 2019 Tomas Orsava - 15.1.0-18 - Bumping due to problems with modular RPM upgrade path - Resolves: rhbz#1695587