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/pypy/
Date: Fri, 30 Dec 2022 14:33:03
Message-Id: 1672410773.dcf88630dc59090ee03ca0493e26fe20f1221f3a.mgorny@gentoo
1 commit: dcf88630dc59090ee03ca0493e26fe20f1221f3a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 30 11:02:27 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 14:32:53 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcf88630
7
8 dev-python/pypy: Bump to 7.3.11
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy/Manifest | 2 +
13 dev-python/pypy/pypy-7.3.11.ebuild | 302 +++++++++++++++++++++++++++++++++++++
14 2 files changed, 304 insertions(+)
15
16 diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
17 index 82c1162a336f..cc6b7d01daff 100644
18 --- a/dev-python/pypy/Manifest
19 +++ b/dev-python/pypy/Manifest
20 @@ -1,2 +1,4 @@
21 DIST pypy2.7-gentoo-patches-7.3.10.tar.xz 5312 BLAKE2B 3ca6d3a01914ae92d93fbd185705dae6bebfd4869a818f4a8058c9df3ea243fd9f1e5b962351f8d07a9679e8020499e81b7d1114d4f1b7493dc1d34c8c04409e SHA512 6758894f6d66dc99a13471cf373c5a2d2bbf37ac561e8d7c4f57ec2f1a9653cf9859547d9a7a80e7f0f7df16078030a4b1cee69536958176f0261da49493310e
22 +DIST pypy2.7-gentoo-patches-7.3.11.tar.xz 5312 BLAKE2B 3692453a184a88d61fe1dd7aa815aa02a4bdf4b29defd2e98a354261784643f78799b979bb356c19311b40932cc7f8b8e050e10553755a846938951a87021bc9 SHA512 24308317d92b278f9f7d74327303ebba34628a2d8dd5798ae3d472d14fd0519a470b6f9c420da88e07251215342a1e4f5cf8d4230f9663119274d3194d3811a5
23 DIST pypy2.7-v7.3.10-src.tar.bz2 19865458 BLAKE2B 0ba83b873daf99b20bd38ee63734c7ceb47b6a7e9cb4bdab1ebbd5672767411f0bf926a19a7074cbfc154a8d83e3679c98fe38c5b6e00c1a4a3fab5424b5ba5d SHA512 750427ce03fdc39f8b6df528f5a2b17f33429433f583a7c46a6b9564f7e398616ae61efb635a4bc0a1f8916ca1881bf1f6347a7ea1748c09ae02e4d88315986d
24 +DIST pypy2.7-v7.3.11-src.tar.bz2 19850421 BLAKE2B ed8bd61e3857c37689f24a23d38d5043bd190ee0e6de5d7906284ea2eab5e7aeff5c994c22f97195f5a1ded2867725f74dc562b375c0165b6231eae69213c06e SHA512 31fd93fe3e761fd096ff52c2a0afa40f78e4df700deb911e221d1682b35e8374c9deac7ba19b474f7ca7a366d3ae9b36ebaf78e81c4ec8306431fd0873daea55
25
26 diff --git a/dev-python/pypy/pypy-7.3.11.ebuild b/dev-python/pypy/pypy-7.3.11.ebuild
27 new file mode 100644
28 index 000000000000..18468b85d8c6
29 --- /dev/null
30 +++ b/dev-python/pypy/pypy-7.3.11.ebuild
31 @@ -0,0 +1,302 @@
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
38 +
39 +PYPY_PV=${PV%_p*}
40 +MY_P=pypy2.7-v${PYPY_PV/_}
41 +PATCHSET="pypy2.7-gentoo-patches-${PV/_rc/rc}"
42 +
43 +DESCRIPTION="A fast, compliant alternative implementation of the Python language"
44 +HOMEPAGE="https://www.pypy.org/"
45 +SRC_URI="
46 + https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
47 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
48 +"
49 +S="${WORKDIR}/${MY_P}-src"
50 +
51 +LICENSE="MIT"
52 +# pypy -c 'import sysconfig; print sysconfig.get_config_var("SOABI")'
53 +SLOT="0/73"
54 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
55 +IUSE="bzip2 full-stdlib gdbm +jit ncurses sqlite tk"
56 +RESTRICT="!full-stdlib? ( test )"
57 +
58 +RDEPEND="
59 + || (
60 + >=dev-python/pypy-exe-bin-${PYPY_PV}:${PYPY_PV}
61 + >=dev-python/pypy-exe-${PYPY_PV}:${PYPY_PV}[bzip2?,ncurses?]
62 + )
63 + dev-libs/openssl:0=
64 + gdbm? ( sys-libs/gdbm:0= )
65 + sqlite? ( dev-db/sqlite:3= )
66 + tk? (
67 + dev-lang/tk:0=
68 + dev-tcltk/tix:0=
69 + )
70 + !<dev-python/pypy-bin-7.3.0:0
71 +"
72 +DEPEND="
73 + ${RDEPEND}
74 +"
75 +
76 +src_prepare() {
77 + local PATCHES=(
78 + "${WORKDIR}/${PATCHSET}"
79 + )
80 + default
81 +}
82 +
83 +src_compile() {
84 + # copy over to make sys.prefix happy
85 + cp -p "${BROOT}"/usr/lib/pypy2.7/pypy-c-${PYPY_PV} pypy-c || die
86 + cp -p "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/* include/ || die
87 + # (not installed by pypy)
88 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
89 + mv pypy/module/cpyext/include/* include/ || die
90 + mv pypy/module/cpyext/parse/*.h include/ || die
91 + pax-mark m pypy-c
92 +
93 + # verify the subslot
94 + local soabi=$(
95 + ./pypy-c - <<-EOF
96 + import sysconfig
97 + print sysconfig.get_config_var("SOABI")
98 + EOF
99 + )
100 + [[ ${soabi#pypy-} == ${SLOT#*/} ]] || die "update subslot to ${soabi}"
101 +
102 + einfo "Generating caches and CFFI modules ..."
103 +
104 + if use full-stdlib; then
105 + # Generate Grammar and PatternGrammar pickles.
106 + ./pypy-c - <<-EOF || die "Generation of Grammar and PatternGrammar pickles failed"
107 + import lib2to3.pygram
108 + import lib2to3.patcomp
109 + lib2to3.patcomp.PatternCompiler()
110 + EOF
111 +
112 + # Generate cffi modules
113 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
114 + cffi_targets=( pypy_util ssl audioop syslog pwdgrp resource )
115 + use gdbm && cffi_targets+=( gdbm )
116 + use ncurses && cffi_targets+=( curses )
117 + use sqlite && cffi_targets+=( sqlite3 )
118 + use tk && cffi_targets+=( tkinter/tklib )
119 +
120 + local t
121 + # all modules except tkinter output to .
122 + # tkinter outputs to the correct dir ...
123 + cd lib_pypy || die
124 + for t in "${cffi_targets[@]}"; do
125 + # tkinter doesn't work via -m
126 + ../pypy-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
127 + done
128 +
129 + # Verify that CFFI module list is up-to-date
130 + local expected_cksum=2d3acf18
131 + local local_cksum=$(
132 + ../pypy-c - <<-EOF
133 + import binascii
134 + import json
135 + from pypy_tools.build_cffi_imports import cffi_build_scripts as x
136 + print("%08x" % (binascii.crc32(json.dumps(x)),))
137 + EOF
138 + )
139 + if [[ ${local_cksum} != ${expected_cksum} ]]; then
140 + die "Please verify cffi_targets and update checksum to ${local_cksum}"
141 + fi
142 +
143 + # Cleanup temporary objects
144 + find -name "_cffi_*.[co]" -delete || die
145 + find -type d -empty -delete || die
146 + fi
147 +}
148 +
149 +src_test() {
150 + # (unset)
151 + local -x PYTHONDONTWRITEBYTECODE=
152 + local -x COLUMNS=80
153 +
154 + local ignored_tests=(
155 + # network
156 + --ignore=lib-python/2.7/test/test_urllibnet.py
157 + --ignore=lib-python/2.7/test/test_urllib2net.py
158 + # lots of free space
159 + --ignore=lib-python/2.7/test/test_zipfile64.py
160 +
161 + # broken by expat-2.4.5
162 + --ignore=lib-python/2.7/test/test_minidom.py
163 + --ignore=lib-python/2.7/test/test_xml_etree.py
164 + --ignore=lib-python/2.7/test/test_xml_etree_c.py
165 + )
166 +
167 + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -vv \
168 + "${ignored_tests[@]}" lib-python || die
169 +}
170 +
171 +src_install() {
172 + local dest=/usr/lib/pypy2.7
173 + einfo "Installing PyPy ..."
174 + dosym pypy-c-${PYPY_PV} "${dest}/pypy-c"
175 + insinto "${dest}"
176 + # preserve mtimes to avoid obsoleting caches
177 + insopts -p
178 + if use full-stdlib; then
179 + doins -r include lib_pypy lib-python
180 +
181 + # replace copied headers with symlinks
182 + for x in "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/*; do
183 + dosym "${PYPY_PV}/${x##*/}" "${dest}/include/${x##*/}"
184 + done
185 +
186 + if ! use gdbm; then
187 + rm -r "${ED}${dest}"/lib_pypy/gdbm.py \
188 + "${ED}${dest}"/lib-python/*2.7/test/test_gdbm.py || die
189 + fi
190 + if ! use sqlite; then
191 + rm -r "${ED}${dest}"/lib-python/*2.7/sqlite3 \
192 + "${ED}${dest}"/lib_pypy/_sqlite3.py \
193 + "${ED}${dest}"/lib-python/*2.7/test/test_sqlite.py || die
194 + fi
195 + if ! use tk; then
196 + rm -r "${ED}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \
197 + "${ED}${dest}"/lib_pypy/_tkinter \
198 + "${ED}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die
199 + fi
200 + else
201 + # install only the absolutely minimal subset of modules needed
202 + # for pypy3 build
203 + local lib_py_modules=(
204 + # base modules needed to even start pypy (and import site)
205 + codecs.py
206 + copy_reg.py
207 + encodings
208 + genericpath.py
209 + linecache.py
210 + os.py
211 + pkgutil.py
212 + posixpath.py
213 + re.py
214 + runpy.py
215 + site.py
216 + sre_compile.py
217 + sre_constants.py
218 + sre_parse.py
219 + stat.py
220 + string.py
221 + sysconfig.py
222 + traceback.py
223 + warnings.py
224 + UserDict.py
225 +
226 + # needed for python_optimize
227 + compileall.py
228 + getopt.py
229 + py_compile.py
230 + struct.py
231 +
232 + # needed for rpython
233 + argparse.py
234 + atexit.py
235 + base64.py
236 + bdb.py
237 + bisect.py
238 + cmd.py
239 + code.py
240 + codeop.py
241 + collections.py
242 + colorsys.py
243 + contextlib.py
244 + copy.py
245 + ctypes
246 + dis.py
247 + fnmatch.py
248 + functools.py
249 + gettext.py
250 + hashlib.py
251 + heapq.py
252 + inspect.py
253 + io.py
254 + json
255 + keyword.py
256 + locale.py
257 + logging
258 + new.py
259 + opcode.py
260 + optparse.py
261 + pdb.py
262 + pickle.py
263 + platform.py
264 + pprint.py
265 + random.py
266 + repr.py
267 + shlex.py
268 + shutil.py
269 + StringIO.py
270 + subprocess.py
271 + tempfile.py
272 + textwrap.py
273 + threading.py
274 + tokenize.py
275 + weakref.py
276 + zipfile.py
277 + )
278 +
279 + local distutils_modules=(
280 + # needed by site
281 + __init__.py
282 + errors.py
283 + sysconfig.py
284 + sysconfig_cpython.py
285 + sysconfig_pypy.py
286 + )
287 +
288 + local lib_pypy_modules=(
289 + # needed by site
290 + _sysconfigdata.py
291 +
292 + # needed by rpython
293 + cffi
294 + _ctypes
295 + _ffi.py
296 + _functools.py
297 + _sha.py
298 + _sha256.py
299 + _sha512.py
300 +
301 + # NB: we're deliberately skipping _hashlib to avoid some deps
302 + )
303 +
304 + cd lib-python/2.7 || die
305 + insinto "${dest}/lib-python/2.7"
306 + doins -r "${lib_py_modules[@]}"
307 + cd - >/dev/null || die
308 +
309 + cd lib-python/2.7/distutils || die
310 + insinto "${dest}/lib-python/2.7/distutils"
311 + doins -r "${distutils_modules[@]}"
312 + cd - >/dev/null || die
313 +
314 + cd lib_pypy || die
315 + insinto "${dest}/lib_pypy"
316 + doins -r "${lib_pypy_modules[@]}"
317 + cd - >/dev/null || die
318 + fi
319 +
320 + dosym ../lib/pypy2.7/pypy-c /usr/bin/pypy
321 + dodoc README.rst
322 +
323 + local -x EPYTHON=pypy
324 + local -x PYTHON=${ED}${dest}/pypy-c-${PYPY_PV}
325 + # temporarily copy to build tree to facilitate module builds
326 + cp -p "${BROOT}${dest}/pypy-c-${PYPY_PV}" "${PYTHON}" || die
327 +
328 + einfo "Byte-compiling Python standard library..."
329 + python_optimize "${ED}${dest}"
330 +
331 + # remove to avoid collisions
332 + rm "${PYTHON}" || die
333 +}