Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3/
Date: Fri, 30 Dec 2022 14:33:03
Message-Id: 1672410775.fe6993c122bdaf21858d56fef0feeb31923241d2.mgorny@gentoo
1 commit: fe6993c122bdaf21858d56fef0feeb31923241d2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 30 11:17:57 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 14:32:55 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe6993c1
7
8 dev-python/pypy3: Bump to 7.3.11
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy3/Manifest | 2 +
13 dev-python/pypy3/pypy3-7.3.11.ebuild | 203 +++++++++++++++++++++++++++++++++++
14 2 files changed, 205 insertions(+)
15
16 diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
17 index 71b304496693..96f6fbf35895 100644
18 --- a/dev-python/pypy3/Manifest
19 +++ b/dev-python/pypy3/Manifest
20 @@ -1,2 +1,4 @@
21 DIST pypy3.9-gentoo-patches-7.3.10_p1.tar.xz 10348 BLAKE2B 4daeecd2b6631785ccb22789518599cab84c39da93bd054389f733f9396c90717d7754b5894a4ed1088416327a6e3e147cc4c454caac7e59d63bbca7aa3bd0ab SHA512 1a149ac967a5bb0facfdb801b816d2a527e6e16183c3301f38d6467c269994d165928ece2c5cf39650516c952aceaadf6e0ec70a2bf62c81c9ba1ed978da6bdf
22 +DIST pypy3.9-gentoo-patches-7.3.11.tar.xz 6444 BLAKE2B adcc1ae4c3ae2c5317a05d6de51785945625d8bcc7cb35bd6608fa80f09b37c483c95663eacb0353013a5abec308d25b12666699c65512f5f3a6d7345f2b5b18 SHA512 f2064ecffa09ba23f5f8c281ca4c8c0740cb6b57185d66c02eec2bcb77cfb566b1a2db4f52c472bcaf0d5fb759ee8003b27761af37785d12465c2010fd73c49d
23 DIST pypy3.9-v7.3.10-src.tar.bz2 23416039 BLAKE2B 1b13e8bbe6c38c4b9183a632063aeed593986bc7906cfe527fa7534d29f9b1ae0f1e6d3795ff73be19f5737c3fd9d1b3cc2777f30d9237d853e4266bea60a5bb SHA512 1ed3fc9cdda7f3144141fc6a37b124e7141cb3f294ce8b5ca3c3aa30a3c58715e168879decaa796c890a9a287c82c2dbabb81db5f6b8d17f4215d7d3261fe9a8
24 +DIST pypy3.9-v7.3.11-src.tar.bz2 23460769 BLAKE2B fa8a827c28813243926c8689addb008c0a43acdc3f81a18749a8f2c1926b6294f2c0c95a4c315e3b77ce84b4f337af7a0bce5daf8dcb60ead965532d4af183cb SHA512 33c978ffbeeb39453028d1d1646ccfdace062ce48a5d939245bea41643038dd3687e80e34f88fa0622bcb175d7dd78f75cbe36b24229c8052f09d2d17dcdfd8c
25
26 diff --git a/dev-python/pypy3/pypy3-7.3.11.ebuild b/dev-python/pypy3/pypy3-7.3.11.ebuild
27 new file mode 100644
28 index 000000000000..e203c371b1f8
29 --- /dev/null
30 +++ b/dev-python/pypy3/pypy3-7.3.11.ebuild
31 @@ -0,0 +1,203 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +inherit pax-utils python-utils-r1 toolchain-funcs
38 +
39 +PYPY_PV=${PV%_p*}
40 +MY_P=pypy3.9-v${PYPY_PV/_rc/rc}
41 +PATCHSET="pypy3.9-gentoo-patches-${PV/_rc/rc}"
42 +
43 +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.9) language"
44 +HOMEPAGE="
45 + https://www.pypy.org/
46 + https://foss.heptapod.net/pypy/pypy/
47 +"
48 +SRC_URI="
49 + https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
50 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
51 +"
52 +S="${WORKDIR}/${MY_P}-src"
53 +
54 +LICENSE="MIT"
55 +# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
56 +# also check pypy/interpreter/pycode.py -> pypy_incremental_magic
57 +SLOT="0/pypy39-pp73-336"
58 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
59 +IUSE="+ensurepip gdbm +jit ncurses sqlite tk"
60 +# many tests are failing upstream
61 +# see https://buildbot.pypy.org/summary?branch=py3.9
62 +RESTRICT="test"
63 +
64 +RDEPEND="
65 + || (
66 + >=dev-python/pypy3-exe-${PYPY_PV}:3.9-${PYPY_PV}[bzip2(+),ncurses?]
67 + >=dev-python/pypy3-exe-bin-${PYPY_PV}:3.9-${PYPY_PV}
68 + )
69 + dev-lang/python-exec[python_targets_pypy3(-)]
70 + dev-libs/openssl:0=
71 + ensurepip? ( dev-python/ensurepip-wheels )
72 + gdbm? ( sys-libs/gdbm:0= )
73 + sqlite? ( dev-db/sqlite:3= )
74 + tk? (
75 + dev-lang/tk:0=
76 + dev-tcltk/tix:0=
77 + )
78 +"
79 +DEPEND="
80 + ${RDEPEND}
81 +"
82 +
83 +src_prepare() {
84 + local PATCHES=(
85 + "${WORKDIR}/${PATCHSET}"
86 + )
87 + default
88 +
89 + eapply_user
90 +}
91 +
92 +src_configure() {
93 + tc-export CC
94 +}
95 +
96 +src_compile() {
97 + mkdir bin || die
98 + # switch to the layout expected for cffi module builds
99 + mkdir include/pypy3.9 || die
100 + # copy over to make sys.prefix happy
101 + cp -p "${BROOT}"/usr/bin/pypy3.9-c-${PYPY_PV} pypy3.9-c || die
102 + cp -p "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/* include/pypy3.9/ || die
103 + # (not installed by pypy-exe)
104 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
105 + mv pypy/module/cpyext/include/* include/pypy3.9/ || die
106 + mv pypy/module/cpyext/parse/*.h include/pypy3.9/ || die
107 + pax-mark m pypy3.9-c
108 +
109 + # verify the subslot
110 + local soabi=$(
111 + ./pypy3.9-c - <<-EOF
112 + import importlib.util
113 + import sysconfig
114 + soabi = sysconfig.get_config_var("SOABI")
115 + magic = importlib.util._RAW_MAGIC_NUMBER & 0xffff
116 + print(f"{soabi}-{magic}")
117 + EOF
118 + )
119 + [[ ${soabi} == ${SLOT#*/} ]] || die "update subslot to ${soabi}"
120 +
121 + # Add epython.py to the distribution
122 + echo 'EPYTHON="pypy3"' > lib-python/3/epython.py || die
123 +
124 + einfo "Generating caches and CFFI modules ..."
125 +
126 + # Generate sysconfig data
127 + local host_gnu_type=$(sh pypy/tool/release/config.guess)
128 + local overrides=(
129 + HOST_GNU_TYPE "${host_gnu_type:-unknown}"
130 + INCLUDEPY "${EPREFIX}/usr/include/pypy3.9"
131 + LIBDIR "${EPREFIX}/usr/$(get_libdir)"
132 + TZPATH "${EPREFIX}/usr/share/zoneinfo"
133 + WHEEL_PKG_DIR "${EPREFIX}/usr/lib/python/ensurepip"
134 + )
135 + ./pypy3.9-c -m sysconfig --generate-posix-vars "${overrides[@]}" || die
136 + local outdir
137 + outdir=$(<pybuilddir.txt) || die
138 + cp "${outdir}"/_sysconfigdata__*.py lib-python/3/ || die
139 +
140 + # Generate Grammar and PatternGrammar pickles.
141 + ./pypy3.9-c - <<-EOF || die "Generation of Grammar and PatternGrammar pickles failed"
142 + import lib2to3.pygram
143 + import lib2to3.patcomp
144 + lib2to3.patcomp.PatternCompiler()
145 + EOF
146 +
147 + # Generate cffi modules
148 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
149 + # (NB: we build CFFI modules first to avoid error log when importing
150 + # build_cffi_imports).
151 + cffi_targets=( pypy_util blake2/_blake2 sha3/_sha3 ssl
152 + audioop syslog pwdgrp resource lzma posixshmem )
153 + use gdbm && cffi_targets+=( gdbm )
154 + use ncurses && cffi_targets+=( curses )
155 + use sqlite && cffi_targets+=( sqlite3 )
156 + use tk && cffi_targets+=( tkinter/tklib )
157 +
158 + local t
159 + # all modules except tkinter output to .
160 + # tkinter outputs to the correct dir ...
161 + cd lib_pypy || die
162 + for t in "${cffi_targets[@]}"; do
163 + # tkinter doesn't work via -m
164 + ../pypy3.9-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
165 + done
166 +
167 + # Verify that CFFI module list is up-to-date
168 + local expected_cksum=63d4659f
169 + local local_cksum=$(
170 + ../pypy3.9-c - <<-EOF
171 + import binascii
172 + import json
173 + from pypy_tools.build_cffi_imports import cffi_build_scripts as x
174 + print("%08x" % (binascii.crc32(json.dumps(x).encode()),))
175 + EOF
176 + )
177 + if [[ ${local_cksum} != ${expected_cksum} ]]; then
178 + die "Please verify cffi_targets and update checksum to ${local_cksum}"
179 + fi
180 +
181 + # Cleanup temporary objects
182 + find -name "*_cffi.[co]" -delete || die
183 + find -type d -empty -delete || die
184 +}
185 +
186 +src_install() {
187 + einfo "Installing PyPy ..."
188 + dodir /usr/bin
189 + dosym pypy3.9-c-${PYPY_PV} /usr/bin/pypy3.9
190 + dosym pypy3.9 /usr/bin/pypy3
191 + insinto /usr/lib/pypy3.9
192 + # preserve mtimes to avoid obsoleting caches
193 + insopts -p
194 + doins -r lib-python/3/. lib_pypy/.
195 + insinto /usr/include
196 + doins -r include/pypy3.9
197 +
198 + # replace copied headers with symlinks
199 + for x in "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/*; do
200 + dosym "${PYPY_PV}/${x##*/}" "/usr/include/pypy3.9/${x##*/}"
201 + done
202 +
203 + dodoc README.rst
204 +
205 + local dest=/usr/lib/pypy3.9
206 + rm -r "${ED}${dest}"/ensurepip/_bundled || die
207 + if ! use ensurepip; then
208 + rm -r "${ED}${dest}"/ensurepip || die
209 + fi
210 + if ! use gdbm; then
211 + rm -r "${ED}${dest}"/_gdbm* || die
212 + fi
213 + if ! use sqlite; then
214 + rm -r "${ED}${dest}"/sqlite3 \
215 + "${ED}${dest}"/_sqlite3* \
216 + "${ED}${dest}"/test/test_sqlite.py || die
217 + fi
218 + if ! use tk; then
219 + rm -r "${ED}${dest}"/{idlelib,tkinter} \
220 + "${ED}${dest}"/_tkinter \
221 + "${ED}${dest}"/test/test_{tcl,tk,ttk*}.py || die
222 + fi
223 +
224 + local -x EPYTHON=pypy3
225 + local -x PYTHON=${ED}/usr/bin/pypy3.9-c-${PYPY_PV}
226 + # temporarily copy to build tree to facilitate module builds
227 + cp -p "${BROOT}/usr/bin/pypy3.9-c-${PYPY_PV}" "${PYTHON}" || die
228 +
229 + einfo "Byte-compiling Python standard library..."
230 + python_optimize "${ED}${dest}"
231 +
232 + # remove to avoid collisions
233 + rm "${PYTHON}" || die
234 +}