diff --git a/189-use-rpm-wheels.patch b/189-use-rpm-wheels.patch new file mode 100644 index 0000000..2caefe2 --- /dev/null +++ b/189-use-rpm-wheels.patch @@ -0,0 +1,67 @@ +diff --git a/lib-python/3/ensurepip/__init__.py b/lib-python/3/ensurepip/__init__.py +index 25c5567..6d8d09c 100644 +--- a/lib-python/3/ensurepip/__init__.py ++++ b/lib-python/3/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)) + diff --git a/pypy3.spec b/pypy3.spec index 7193654..7fc7257 100644 --- a/pypy3.spec +++ b/pypy3.spec @@ -2,7 +2,7 @@ Name: pypy3 Version: %{basever}.0 %global pyversion 3.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python 3 implementation with a Just-In-Time compiler # LGPL and another free license we'd need to ask spot about are present in some @@ -18,6 +18,10 @@ ExcludeArch: aarch64 %{power64} # High-level configuration of the build: +# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package +# Uses upstream bundled prebuilt wheels otherwise +%bcond_without rpmwheels + # PyPy consists of an implementation of an interpreter (with JIT compilation) # for the full Python language written in a high-level language, leaving many # of the implementation details as "pluggable" policies. @@ -165,6 +169,11 @@ Patch9: 009-add-libxcrypt-support.patch # It seems ppc64 has no faulthandler Patch11: 011-no-faulthandler.patch +# Instead of bundled wheels, use our RPM packaged wheels from +# /usr/share/python-wheels +# We conditionally apply this, but we use autosetup, so we use Source here +Source189: 189-use-rpm-wheels.patch + # Fix multiprocessing regression on newer glibcs # See: https://bugzilla.redhat.com/show_bug.cgi?id=1569933 # and: https://bugs.python.org/issue33329 @@ -249,6 +258,11 @@ BuildRequires: emacs # For %%autosetup -S git BuildRequires: %{_bindir}/git +%if %{with rpmwheels} +BuildRequires: python-setuptools-wheel +BuildRequires: python-pip-wheel +%endif + # Metadata for the core package (the JIT build): Requires: %{name}-libs%{?_isa} = %{version}-%{release} Provides: %{name}(abi) = %{basever} @@ -275,6 +289,14 @@ Summary: Run-time libraries used by PyPy implementations of Python 3 Requires: emacs-filesystem >= %{_emacs_version} %endif +%if %{with rpmwheels} +Requires: python-setuptools-wheel +Requires: python-pip-wheel +%else +Provides: bundled(python3-pip) = 9.0.1 +Provides: bundled(python3-setuptools) = 28.8.0 +%endif + %description libs Libraries required by the various PyPy implementations of Python 3. @@ -298,6 +320,17 @@ Build of PyPy3 with support for micro-threads for massive concurrency %prep %autosetup -n pypy3-v%{version}-src -p1 -S git +%if %{with rpmwheels} +%apply_patch -m %(basename %{SOURCE189}) %{SOURCE189} +rm lib-python/3/ensurepip/_bundled/*.whl +rmdir lib-python/3/ensurepip/_bundled +%else +# we don't want to ship the old ones anyway +rm lib-python/3/ensurepip/_bundled/pip-8.1.2-* +rm lib-python/3/ensurepip/_bundled/setuptools-21.2.1-* +%endif + + # Replace /usr/local/bin/python or /usr/bin/env python shebangs with /usr/bin/python2 or pypy2: find -name "*.py" -exec \ sed \ @@ -835,6 +868,9 @@ CheckPyPy %{name}-stackless %changelog +* Tue Aug 21 2018 Miro HronĨok - 6.0.0-3 +- Use RPM packaged wheels + * Fri Jul 13 2018 Fedora Release Engineering - 6.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild