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: Wed, 30 Mar 2022 15:13:20
Message-Id: 1648653182.b2f7cd62d8f6810e9ae1efcc65afbcc1ac3149e2.mgorny@gentoo
1 commit: b2f7cd62d8f6810e9ae1efcc65afbcc1ac3149e2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 30 10:53:22 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 30 15:13:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2f7cd62
7
8 dev-python/pypy: Bump to 7.3.9
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.9.ebuild | 183 ++++++++++++++++++++++++++++++++++++++
14 2 files changed, 185 insertions(+)
15
16 diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
17 index b22b36917ccc..c5323d318202 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.8.tar.xz 7428 BLAKE2B 5362c34929e2053fc9a806e9894f35cce02ba1ebfad66cc64acc200ade4317934ee50dbc072194d19e201dea2a678abd609001ffe7e39bd6890a3b26c9d6d00e SHA512 6a7bfadac8f638e69419a6a1536af595a63bb2b4e3028da6423bd164d3df5399901b217468b1b374a5162ca8d2e5a61c4a19996f9e63109ed414a1aedcaac5d6
22 +DIST pypy2.7-gentoo-patches-7.3.9.tar.xz 7428 BLAKE2B 0a42e3c04ac0e560d56ce7218db81fa55f74ad45a4a033ccda8c5fba34e3a0b1f06587b5b18e947170cc635bd44e5a7799daeec9319c6a09165a73b32554a4b6 SHA512 3a52d40ccf8d77f3493a763b51e4bf86a808f6478191ed4eeaa4f2c2ce8b75769c3880d07cbc7614d8af5573f3e8edfe694be41626b947f3d06c321cf4f59abd
23 DIST pypy2.7-v7.3.8-src.tar.bz2 23279006 BLAKE2B 7b2f5bfaffb99d3444f355039f743a21016dea22cc78cd5feca05eb12ce0e5ed39dafd22a8726994d0aff789e68b506197680e7181087313d2c5cd17b674ae4d SHA512 6ff90fad998c25aec5823e61d65266c169e89cba2ee2e3b6d0864d34d69a6b9fe7ad4d591bc8b38a48c5c22ea3dd468d3188cd34e03746c258752eaa24ac3ae2
24 +DIST pypy2.7-v7.3.9-src.tar.bz2 23328628 BLAKE2B 50d015439b6a6f15dd24eb4524726a2054f0d8e7ef209b54dc4eb9365b41b333f3dad525422316af3ff19e6ffb5866859db4455e05fc1529a81ce3b6e7c621db SHA512 8d7513d4efe924f2456dd65a45a82dd16171f7962c81ba90f2a168c332cdad78ceffa3ed1af379c09e61082b39d5c2a8385cd77c89b698c47cc75e9df1bb4d2a
25
26 diff --git a/dev-python/pypy/pypy-7.3.9.ebuild b/dev-python/pypy/pypy-7.3.9.ebuild
27 new file mode 100644
28 index 000000000000..0ba6e357497b
29 --- /dev/null
30 +++ b/dev-python/pypy/pypy-7.3.9.ebuild
31 @@ -0,0 +1,183 @@
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 gdbm +jit ncurses sqlite tk"
56 +
57 +RDEPEND="
58 + || (
59 + >=dev-python/pypy-exe-${PYPY_PV}:${PYPY_PV}[bzip2?,ncurses?]
60 + >=dev-python/pypy-exe-bin-${PYPY_PV}:${PYPY_PV}
61 + )
62 + dev-libs/openssl:0=
63 + gdbm? ( sys-libs/gdbm:0= )
64 + sqlite? ( dev-db/sqlite:3= )
65 + tk? (
66 + dev-lang/tk:0=
67 + dev-tcltk/tix:0=
68 + )
69 + !<dev-python/pypy-bin-7.3.0:0
70 +"
71 +DEPEND="
72 + ${RDEPEND}
73 +"
74 +
75 +src_prepare() {
76 + local PATCHES=(
77 + "${WORKDIR}/${PATCHSET}"
78 + )
79 + default
80 +}
81 +
82 +src_compile() {
83 + # copy over to make sys.prefix happy
84 + cp -p "${BROOT}"/usr/lib/pypy2.7/pypy-c-${PYPY_PV} pypy-c || die
85 + cp -p "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/* include/ || die
86 + # (not installed by pypy)
87 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
88 + mv pypy/module/cpyext/include/* include/ || die
89 + mv pypy/module/cpyext/parse/*.h include/ || die
90 + pax-mark m pypy-c
91 +
92 + # verify the subslot
93 + local soabi=$(
94 + ./pypy-c - <<-EOF
95 + import sysconfig
96 + print sysconfig.get_config_var("SOABI")
97 + EOF
98 + )
99 + [[ ${soabi#pypy-} == ${SLOT#*/} ]] || die "update subslot to ${soabi}"
100 +
101 + einfo "Generating caches and CFFI modules ..."
102 +
103 + # Generate Grammar and PatternGrammar pickles.
104 + ./pypy-c - <<-EOF || die "Generation of Grammar and PatternGrammar pickles failed"
105 + import lib2to3.pygram
106 + import lib2to3.patcomp
107 + lib2to3.patcomp.PatternCompiler()
108 + EOF
109 +
110 + # Generate cffi modules
111 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
112 + cffi_targets=( pypy_util ssl audioop syslog pwdgrp resource )
113 + use gdbm && cffi_targets+=( gdbm )
114 + use ncurses && cffi_targets+=( curses )
115 + use sqlite && cffi_targets+=( sqlite3 )
116 + use tk && cffi_targets+=( tkinter/tklib )
117 +
118 + local t
119 + # all modules except tkinter output to .
120 + # tkinter outputs to the correct dir ...
121 + cd lib_pypy || die
122 + for t in "${cffi_targets[@]}"; do
123 + # tkinter doesn't work via -m
124 + ../pypy-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
125 + done
126 +
127 + # Verify that CFFI module list is up-to-date
128 + local expected_cksum=2d3acf18
129 + local local_cksum=$(
130 + ../pypy-c - <<-EOF
131 + import binascii
132 + import json
133 + from pypy_tools.build_cffi_imports import cffi_build_scripts as x
134 + print("%08x" % (binascii.crc32(json.dumps(x)),))
135 + EOF
136 + )
137 + if [[ ${local_cksum} != ${expected_cksum} ]]; then
138 + die "Please verify cffi_targets and update checksum to ${local_cksum}"
139 + fi
140 +
141 + # Cleanup temporary objects
142 + find -name "_cffi_*.[co]" -delete || die
143 + find -type d -empty -delete || die
144 +}
145 +
146 +src_test() {
147 + # (unset)
148 + local -x PYTHONDONTWRITEBYTECODE=
149 + local -x COLUMNS=80
150 +
151 + local ignored_tests=(
152 + # network
153 + --ignore=lib-python/2.7/test/test_urllibnet.py
154 + --ignore=lib-python/2.7/test/test_urllib2net.py
155 + # lots of free space
156 + --ignore=lib-python/2.7/test/test_zipfile64.py
157 +
158 + # broken by expat-2.4.5
159 + --ignore=lib-python/2.7/test/test_minidom.py
160 + --ignore=lib-python/2.7/test/test_xml_etree.py
161 + --ignore=lib-python/2.7/test/test_xml_etree_c.py
162 + )
163 +
164 + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -vv \
165 + "${ignored_tests[@]}" lib-python || die
166 +}
167 +
168 +src_install() {
169 + local dest=/usr/lib/pypy2.7
170 + einfo "Installing PyPy ..."
171 + dosym pypy-c-${PYPY_PV} "${dest}/pypy-c"
172 + insinto "${dest}"
173 + # preserve mtimes to avoid obsoleting caches
174 + insopts -p
175 + doins -r include lib_pypy lib-python
176 +
177 + # replace copied headers with symlinks
178 + for x in "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/*; do
179 + dosym "${PYPY_PV}/${x##*/}" "${dest}/include/${x##*/}"
180 + done
181 +
182 + dosym ../lib/pypy2.7/pypy-c /usr/bin/pypy
183 + dodoc README.rst
184 +
185 + if ! use gdbm; then
186 + rm -r "${ED}${dest}"/lib_pypy/gdbm.py \
187 + "${ED}${dest}"/lib-python/*2.7/test/test_gdbm.py || die
188 + fi
189 + if ! use sqlite; then
190 + rm -r "${ED}${dest}"/lib-python/*2.7/sqlite3 \
191 + "${ED}${dest}"/lib_pypy/_sqlite3.py \
192 + "${ED}${dest}"/lib-python/*2.7/test/test_sqlite.py || die
193 + fi
194 + if ! use tk; then
195 + rm -r "${ED}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \
196 + "${ED}${dest}"/lib_pypy/_tkinter \
197 + "${ED}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die
198 + fi
199 +
200 + local -x EPYTHON=pypy
201 + local -x PYTHON=${ED}${dest}/pypy-c-${PYPY_PV}
202 + # temporarily copy to build tree to facilitate module builds
203 + cp -p "${BROOT}${dest}/pypy-c-${PYPY_PV}" "${PYTHON}" || die
204 +
205 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
206 + python_moduleinto /usr/lib/pypy2.7/site-packages
207 + python_domodule epython.py
208 +
209 + einfo "Byte-compiling Python standard library..."
210 + python_optimize "${ED}${dest}"
211 +
212 + # remove to avoid collisions
213 + rm "${PYTHON}" || die
214 +}