Initial PyPy 3.10 package

This commit is contained in:
Miro Hrončok 2023-08-02 00:41:55 +02:00
parent f8ee99bc22
commit 706600f67e
6 changed files with 13 additions and 79 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@
/pypy3.9-v7.3.9-src.tar.bz2
/pypy3.9-v7.3.11-src.tar.bz2
/pypy3.9-v7.3.12-src.tar.bz2
/pypy3.10-v7.3.12-src.tar.bz2

View File

@ -1,61 +0,0 @@
diff --git a/lib-python/3/ensurepip/__init__.py b/lib-python/3/ensurepip/__init__.py
index e510cc7..8b736b8 100644
--- a/lib-python/3/ensurepip/__init__.py
+++ b/lib-python/3/ensurepip/__init__.py
@@ -1,3 +1,5 @@
+import distutils.version
+import glob
import os
import os.path
import sys
@@ -6,13 +8,28 @@ import tempfile
import subprocess
from importlib import resources
-from . import _bundled
+__all__ = ["version", "bootstrap"]
+_WHEEL_DIR = "/usr/share/python-wheels/"
+
+_wheels = {}
+
+def _get_most_recent_wheel_version(pkg):
+ prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg))
+ _wheels[pkg] = {}
+ for suffix in "-py2.py3-none-any.whl", "-py3-none-any.whl":
+ pattern = "{}*{}".format(prefix, suffix)
+ for path in glob.glob(pattern):
+ version_str = path[len(prefix):-len(suffix)]
+ _wheels[pkg][version_str] = os.path.basename(path)
+ return str(max(_wheels[pkg], key=distutils.version.LooseVersion))
+
+
+_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
+
+_PIP_VERSION = _get_most_recent_wheel_version("pip")
-__all__ = ["version", "bootstrap"]
-_SETUPTOOLS_VERSION = "58.1.0"
-_PIP_VERSION = "23.0.1"
_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION, "py3"),
("pip", _PIP_VERSION, "py3"),
@@ -101,13 +118,10 @@ def _bootstrap(*, root=None, upgrade=False, user=False,
# additional paths that need added to sys.path
additional_paths = []
for project, version, py_tag in _PROJECTS:
- wheel_name = "{}-{}-{}-none-any.whl".format(project, version, py_tag)
- whl = resources.read_binary(
- _bundled,
- wheel_name,
- )
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
- fp.write(whl)
+ wheel_name = _wheels[project][version]
+ 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))

View File

@ -1,7 +1,7 @@
%global basever 7.3
%global micro 12
#global pre ...
%global pyversion 3.9
%global pyversion 3.10
Name: pypy%{pyversion}
Version: %{basever}.%{micro}%{?pre:~%{pre}}
%global version_ %{basever}.%{micro}%{?pre}
@ -74,7 +74,7 @@ ExcludeArch: %{ix86}
# 2. inside the <id>python-classroom</id> group locate <packagereq ...>pypy3.N-devel</packagereq>
# 3. change the package name to match the new version
# 4. submit changes as a pull request and make sure somebody merges it
%bcond_without main_pypy3
%bcond_with main_pypy3
%ifarch %{ix86} x86_64 %{arm}
%global _package_note_linker gold
@ -109,11 +109,6 @@ Patch7: 007-remove-startup-message.patch
# https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt
Patch9: 009-add-libxcrypt-support.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
# Build-time requirements:
# pypy's can be rebuilt using pypy2, rather than with CPython 2; doing so
@ -315,12 +310,11 @@ Header files for building C extension modules against PyPy%{pyversion}.
%prep
%autosetup -n pypy%{pyversion}-v%{version_}-src -p1 -S git
# Temporary workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1954999
%{?!apply_patch:%define apply_patch(qp:m:) {%__apply_patch %**}}
%if %{with rpmwheels}
%apply_patch -m %(basename %{SOURCE189}) %{SOURCE189}
# Instead of bundled wheels, use our RPM packaged wheels from /usr/share/python-wheels
rm lib-python/3/ensurepip/_bundled/*.whl
# This append to _sysconfigdata.py is a hacked equivalent to CPython's configure --with-wheel-pkg-dir
echo "build_time_vars['WHEEL_PKG_DIR'] = '%{python_wheel_dir}'" >> lib_pypy/_sysconfigdata.py
%endif
@ -356,9 +350,6 @@ rm lib-python/3/idlelib/idle.bat
ln -s lib_pypy/cffi/_pycparser pycparser
%endif
# Remove windows executable binaries
rm lib-python/3/distutils/command/*.exe
%build
# Top memory usage is about 4.5GB on arm7hf
free
@ -836,6 +827,9 @@ CheckPyPy pypy%{pyversion}-c
%changelog
* Wed Jul 26 2023 Miro Hrončok <mhroncok@redhat.com> - 7.3.12-1.3.10
- Initial PyPy 3.10 package
* Wed Jul 26 2023 Miro Hrončok <mhroncok@redhat.com> - 7.3.12-1.3.9
- Update to 7.3.12
- Fixes: rhbz#2203423

View File

@ -1 +1 @@
SHA512 (pypy3.9-v7.3.12-src.tar.bz2) = 8e819a1ec3f3ce7fc5f901fb554660288a57e2a4834a3da35c1a57faf88ef4129240628a58334d2e0c2b1dda412da5d85ec943abe8046c0ce5d0cd0a0f7fc42a
SHA512 (pypy3.10-v7.3.12-src.tar.bz2) = 080520c7de267e17a2823f06cd0a15c108a2c32fc296d6e24782050eb546fa74852d948ede2c381dba110774121b20efc3a07b553acd0ac0db4a844dfc09069e

View File

@ -20,13 +20,13 @@
tests:
- smoke:
dir: python/smoke
run: runuser testuser -c 'PYTHON=pypy3.9 VERSION=3.9 ./venv.sh'
run: runuser testuser -c 'PYTHON=pypy3.10 VERSION=3.10 ./venv.sh'
- smoke_virtualenv:
dir: python/smoke
run: runuser testuser -c 'PYTHON=pypy3.9 VERSION=3.9 METHOD=virtualenv TOX=false ./venv.sh'
run: runuser testuser -c 'PYTHON=pypy3.10 VERSION=3.10 METHOD=virtualenv TOX=false ./venv.sh'
required_packages:
- util-linux
- gcc
- python3-tox
- python3-virtualenv
- pypy3.9-devel
- pypy3.10-devel