#6 Use RPM packaged wheels
Merged 5 years ago by churchyard. Opened 5 years ago by churchyard.
rpms/ churchyard/pypy3 wheels  into  master

@@ -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))

+  

file modified
+40 -3
@@ -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
@@ -12,11 +12,16 @@ 

  License:        MIT and Python and UCD

  URL:            http://pypy.org/

  

- # Not available yet

- ExcludeArch: aarch64

+ # aarch64: Not available yet

+ # ppc64: Broken on F29+ https://bugzilla.redhat.com/show_bug.cgi?id=1619601

+ 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.
@@ -164,6 +169,11 @@ 

  # 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
@@ -248,6 +258,11 @@ 

  # 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}
@@ -274,6 +289,14 @@ 

  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.

  
@@ -297,6 +320,17 @@ 

  %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 \
@@ -834,6 +868,9 @@ 

  

  

  %changelog

+ * Tue Aug 21 2018 Miro Hrončok <mhroncok@redhat.com> - 6.0.0-3

+ - Use RPM packaged wheels

+ 

  * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.0-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

  

no initial comment

2 new commits added

  • Use RPM packaged wheels
  • Poor ppc64(le), it just doesn't build :(
5 years ago

2 new commits added

  • Use RPM packaged wheels
  • Poor ppc64(le), it just doesn't build :(
5 years ago

Pull-Request has been merged by churchyard

5 years ago