|
|
93f96d |
From e5c11f104e1d2543ac3ba4b3f0a7989821e57947 Mon Sep 17 00:00:00 2001
|
|
|
e336cb |
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
|
e336cb |
Date: Wed, 15 Aug 2018 15:36:29 +0200
|
|
|
e336cb |
Subject: [PATCH] 00189: Instead of bundled wheels, use our RPM packaged wheels
|
|
|
e336cb |
|
|
|
e336cb |
We keep them in /usr/share/python-wheels
|
|
|
e336cb |
---
|
|
|
93f96d |
Lib/ensurepip/__init__.py | 26 +++++++++++++++++---------
|
|
|
93f96d |
1 file changed, 17 insertions(+), 9 deletions(-)
|
|
|
e336cb |
|
|
|
e336cb |
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
|
|
|
93f96d |
index fc0edec6e3..4d17e413db 100644
|
|
|
e336cb |
--- a/Lib/ensurepip/__init__.py
|
|
|
e336cb |
+++ b/Lib/ensurepip/__init__.py
|
|
|
93f96d |
@@ -1,16 +1,27 @@
|
|
|
e336cb |
+import distutils.version
|
|
|
e336cb |
+import glob
|
|
|
e336cb |
import os
|
|
|
e336cb |
import os.path
|
|
|
e336cb |
-import pkgutil
|
|
|
e336cb |
import sys
|
|
|
e336cb |
import tempfile
|
|
|
93f96d |
|
|
|
e336cb |
|
|
|
e336cb |
__all__ = ["version", "bootstrap"]
|
|
|
e336cb |
|
|
|
e336cb |
+_WHEEL_DIR = "/usr/share/python38-wheels/"
|
|
|
e336cb |
|
|
|
93f96d |
-_SETUPTOOLS_VERSION = "41.2.0"
|
|
|
e336cb |
|
|
|
93f96d |
-_PIP_VERSION = "19.2.3"
|
|
|
e336cb |
+def _get_most_recent_wheel_version(pkg):
|
|
|
e336cb |
+ prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg))
|
|
|
93f96d |
+ suffix = "-py2.py3-none-any.whl"
|
|
|
93f96d |
+ pattern = "{}*{}".format(prefix, suffix)
|
|
|
93f96d |
+ versions = (p[len(prefix):-len(suffix)] for p in glob.glob(pattern))
|
|
|
93f96d |
+ return str(max(versions, key=distutils.version.LooseVersion))
|
|
|
e336cb |
+
|
|
|
e336cb |
+
|
|
|
e336cb |
+_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
|
|
|
e336cb |
+
|
|
|
e336cb |
+_PIP_VERSION = _get_most_recent_wheel_version("pip")
|
|
|
e336cb |
|
|
|
e336cb |
_PROJECTS = [
|
|
|
93f96d |
("setuptools", _SETUPTOOLS_VERSION),
|
|
|
93f96d |
@@ -96,12 +107,9 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
|
|
|
e336cb |
additional_paths = []
|
|
|
93f96d |
for project, version in _PROJECTS:
|
|
|
93f96d |
wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
|
|
|
e336cb |
- whl = pkgutil.get_data(
|
|
|
e336cb |
- "ensurepip",
|
|
|
e336cb |
- "_bundled/{}".format(wheel_name),
|
|
|
e336cb |
- )
|
|
|
e336cb |
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
|
|
e336cb |
- fp.write(whl)
|
|
|
e336cb |
+ with open(os.path.join(_WHEEL_DIR, wheel_name), "rb") as sfp:
|
|
|
e336cb |
+ with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
|
|
|
e336cb |
+ fp.write(sfp.read())
|
|
|
e336cb |
|
|
|
e336cb |
additional_paths.append(os.path.join(tmpdir, wheel_name))
|
|
|
e336cb |
|
|
|
93f96d |
--
|
|
|
93f96d |
2.21.0
|
|
|
93f96d |
|