Use RPM built wheels instead of the bundled ones
This commit is contained in:
parent
babc5e18f6
commit
0c847d2f33
67
00189-use-rpm-wheels.patch
Normal file
67
00189-use-rpm-wheels.patch
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
|
||||||
|
index 25c5567..2553524 100644
|
||||||
|
--- a/Lib/ensurepip/__init__.py
|
||||||
|
+++ b/Lib/ensurepip/__init__.py
|
||||||
|
@@ -1,16 +1,27 @@
|
||||||
|
+import distutils.version
|
||||||
|
+import glob
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
-import pkgutil
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["version", "bootstrap"]
|
||||||
|
|
||||||
|
+_WHEEL_DIR = "/usr/share/python-wheels/"
|
||||||
|
|
||||||
|
-_SETUPTOOLS_VERSION = "28.8.0"
|
||||||
|
|
||||||
|
-_PIP_VERSION = "9.0.1"
|
||||||
|
+def _get_most_recent_wheel_version(pkg):
|
||||||
|
+ prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg))
|
||||||
|
+ suffix = "-py2.py3-none-any.whl"
|
||||||
|
+ pattern = "{}*{}".format(prefix, suffix)
|
||||||
|
+ versions = (p[len(prefix):-len(suffix)] for p in glob.glob(pattern))
|
||||||
|
+ return str(max(versions, key=distutils.version.LooseVersion))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
|
||||||
|
+
|
||||||
|
+_PIP_VERSION = _get_most_recent_wheel_version("pip")
|
||||||
|
|
||||||
|
# pip currently requires ssl support, so we try to provide a nicer
|
||||||
|
# error message when that is missing (http://bugs.python.org/issue19744)
|
||||||
|
@@ -37,8 +48,13 @@ def _run_pip(args, additional_paths=None):
|
||||||
|
sys.path = additional_paths + sys.path
|
||||||
|
|
||||||
|
# Install the bundled software
|
||||||
|
- import pip
|
||||||
|
- pip.main(args)
|
||||||
|
+ try:
|
||||||
|
+ # pip 10
|
||||||
|
+ from pip._internal import main
|
||||||
|
+ except ImportError:
|
||||||
|
+ # pip 9
|
||||||
|
+ from pip import main
|
||||||
|
+ main(args)
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
@@ -93,12 +109,9 @@ def bootstrap(*, root=None, upgrade=False, user=False,
|
||||||
|
additional_paths = []
|
||||||
|
for project, version in _PROJECTS:
|
||||||
|
wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
|
||||||
|
- whl = pkgutil.get_data(
|
||||||
|
- "ensurepip",
|
||||||
|
- "_bundled/{}".format(wheel_name),
|
||||||
|
- )
|
||||||
|
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
||||||
|
- fp.write(whl)
|
||||||
|
+ with open(os.path.join(_WHEEL_DIR, wheel_name), "rb") as sfp:
|
||||||
|
+ with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
||||||
|
+ fp.write(sfp.read())
|
||||||
|
|
||||||
|
additional_paths.append(os.path.join(tmpdir, wheel_name))
|
||||||
|
|
@ -82,10 +82,13 @@
|
|||||||
Summary: Version 3.5 of the Python programming language
|
Summary: Version 3.5 of the Python programming language
|
||||||
Name: python%{pyshortver}
|
Name: python%{pyshortver}
|
||||||
Version: %{pybasever}.6
|
Version: %{pybasever}.6
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: Python
|
License: Python
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
|
|
||||||
|
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
|
||||||
|
# Uses upstream bundled prebuilt wheels otherwise
|
||||||
|
%bcond_without rpmwheels
|
||||||
|
|
||||||
# =======================
|
# =======================
|
||||||
# Build-time requirements
|
# Build-time requirements
|
||||||
@ -141,6 +144,11 @@ BuildRequires: valgrind-devel
|
|||||||
BuildRequires: xz-devel
|
BuildRequires: xz-devel
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
|
|
||||||
|
%if %{with rpmwheels}
|
||||||
|
BuildRequires: python-setuptools-wheel
|
||||||
|
BuildRequires: python-pip-wheel
|
||||||
|
%endif
|
||||||
|
|
||||||
Requires: expat >= 2.1.0
|
Requires: expat >= 2.1.0
|
||||||
|
|
||||||
# Python 3 built with glibc >= 2.24.90-26 needs to require it (rhbz#1410644).
|
# Python 3 built with glibc >= 2.24.90-26 needs to require it (rhbz#1410644).
|
||||||
@ -335,6 +343,11 @@ Patch186: 00186-dont-raise-from-py_compile.patch
|
|||||||
# relying on this will fail (test_filename_changing_on_output_single_dir)
|
# relying on this will fail (test_filename_changing_on_output_single_dir)
|
||||||
Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
|
Patch188: 00188-fix-lib2to3-tests-when-hashlib-doesnt-compile-properly.patch
|
||||||
|
|
||||||
|
# 00189 #
|
||||||
|
# Instead of bundled wheels, use our RPM packaged wheels from
|
||||||
|
# /usr/share/python-wheels
|
||||||
|
Patch189: 00189-use-rpm-wheels.patch
|
||||||
|
|
||||||
# 00205 #
|
# 00205 #
|
||||||
# LIBPL variable in makefile takes LIBPL from configure.ac
|
# LIBPL variable in makefile takes LIBPL from configure.ac
|
||||||
# but the LIBPL variable defined there doesn't respect libdir macro
|
# but the LIBPL variable defined there doesn't respect libdir macro
|
||||||
@ -412,9 +425,13 @@ URL: http://www.python.org/
|
|||||||
%global __requires_exclude ^python\\(abi\\) = 3\\..$
|
%global __requires_exclude ^python\\(abi\\) = 3\\..$
|
||||||
%global __provides_exclude ^python\\(abi\\) = 3\\..$
|
%global __provides_exclude ^python\\(abi\\) = 3\\..$
|
||||||
|
|
||||||
# We keep those inside on purpose
|
%if %{with rpmwheels}
|
||||||
|
Requires: python-setuptools-wheel
|
||||||
|
Requires: python-pip-wheel
|
||||||
|
%else
|
||||||
Provides: bundled(python3-pip) = 9.0.1
|
Provides: bundled(python3-pip) = 9.0.1
|
||||||
Provides: bundled(python3-setuptools) = 28.8.0
|
Provides: bundled(python3-setuptools) = 28.8.0
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Python %{pybasever} package for developers.
|
Python %{pybasever} package for developers.
|
||||||
@ -492,6 +509,13 @@ rm -r Modules/zlib || exit 1
|
|||||||
%patch180 -p1
|
%patch180 -p1
|
||||||
%patch186 -p1
|
%patch186 -p1
|
||||||
%patch188 -p1
|
%patch188 -p1
|
||||||
|
|
||||||
|
%if %{with rpmwheels}
|
||||||
|
%patch189 -p1
|
||||||
|
rm Lib/ensurepip/_bundled/*.whl
|
||||||
|
rmdir Lib/ensurepip/_bundled
|
||||||
|
%endif
|
||||||
|
|
||||||
%patch205 -p1
|
%patch205 -p1
|
||||||
%patch206 -p1
|
%patch206 -p1
|
||||||
%patch243 -p1
|
%patch243 -p1
|
||||||
@ -1019,6 +1043,9 @@ CheckPython optimized
|
|||||||
# ======================================================
|
# ======================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 21 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-2
|
||||||
|
- Use RPM built wheels of pip and setuptools in ensurepip instead of bundled ones
|
||||||
|
|
||||||
* Sun Aug 05 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-1
|
* Sun Aug 05 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.6-1
|
||||||
- Rebased to version 3.5.6
|
- Rebased to version 3.5.6
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user