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: Wed, 30 Mar 2022 15:13:18
Message-Id: 1648653184.81dfdf1c564ddd39992248bb9c8fc4f4b28be940.mgorny@gentoo
1 commit: 81dfdf1c564ddd39992248bb9c8fc4f4b28be940
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 30 11:01:40 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 30 15:13:04 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=81dfdf1c
7
8 dev-python/pypy3: Bump to 7.3.9
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.9.ebuild | 200 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 202 insertions(+)
15
16 diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
17 index 782c1546b167..270cb1c9ee60 100644
18 --- a/dev-python/pypy3/Manifest
19 +++ b/dev-python/pypy3/Manifest
20 @@ -1,4 +1,6 @@
21 DIST pypy3.8-gentoo-patches-7.3.7.tar.xz 4396 BLAKE2B adc33a02ada4d22eae0484292ec6cc295805d9f254b7a9110c622628aa40011621a1833ca62d3251e4e5056c406f648e7ad0439bd60e77c38808dd9df46973a5 SHA512 1cda8467de2d749d98fa20d7d200b5f96dae0ca68cf44a054d03f3f148bc3946ba1f1c474ac0336560f79c78b3eddcd4ba24386e83de283c83475b8e4b75bdf8
22 DIST pypy3.8-v7.3.7-src.tar.bz2 24375444 BLAKE2B 44fe19ee63d95243c499ecb0b84e77873c73da93320b1e028a5c6c4b167441d223812dc66b16e070308cba48c4d8774738f827319cce9d1769b3f4346e15487c SHA512 9e6701cc441d5535968656cfb0cfa9076c364f9ba32bc6f0ef64f06ab343281e2458dbe88791c0e02401457fbf80d367f397fc904f6146bff68e04a15e05fda2
23 DIST pypy3.9-gentoo-patches-7.3.8.tar.xz 1568 BLAKE2B 0011188de7b5757964bd13c49d5995a656a721acd54e1d77f7e77fac7420a2a56ca75eb42709e2304a771fa69c982fc6901e9fc9580ab8e8b35e7bb8b0cc83a6 SHA512 1064e987b7233fc55f94bd49aeeab9a9fd9322e90798439ad9a4c35020ca923fe0670e47406ab180a6f8e7afd65d03be23427d4fa43befa3c0ce172028e1a09f
24 +DIST pypy3.9-gentoo-patches-7.3.9.tar.xz 1564 BLAKE2B fe0875ef002842a78fb31589f6d0b255c3dea10f2bd014231ae9b17641f65f810ac84fe7961de1a4614249b0166f2127c3aa37947f7d1d4c85860a31b89110f1 SHA512 a1dc3ee36e908e29b2bbbb100a97b7910bd4325c5dc55c0455cdca450d6b272d1463708b383e0607e9499b1932da4442f97d2da57e47ed3a4ff8fd3c78a54732
25 DIST pypy3.9-v7.3.8-src.tar.bz2 26277823 BLAKE2B 343fa4a57b69936a586acb036506e25c8de3a9761eb6622ef7266c136a1dc977cabc23969917bc2369fd73b1ae6fef731d81536179107f2d731352e6f5387bf9 SHA512 aed018738af7a225f516ec37d059d539f486d9dd427fe000805147b197f496d5fcb0387e47008524753ad18224aebeb1e68f9e2093acbe37468e02bff92f7126
26 +DIST pypy3.9-v7.3.9-src.tar.bz2 26976726 BLAKE2B bf1ed21c575901abac020120aaff07ab57f1404713211b19cbd1eb4d6ffc675b7933be8c6fffc2b69ab467963d6598534cd5aa90c02feddad596611d2a6b6581 SHA512 83f8a6a2da351c190d2d224242cbc35e35529c7a8e8d842eaf5c945cbce2e172b02a340f32af3d49df8d5288370d794d5bc95fc12dd4a13d817c925abf06198a
27
28 diff --git a/dev-python/pypy3/pypy3-7.3.9.ebuild b/dev-python/pypy3/pypy3-7.3.9.ebuild
29 new file mode 100644
30 index 000000000000..536c3974f232
31 --- /dev/null
32 +++ b/dev-python/pypy3/pypy3-7.3.9.ebuild
33 @@ -0,0 +1,200 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +PYTHON_COMPAT=( python2_7 )
40 +inherit pax-utils python-any-r1 toolchain-funcs
41 +
42 +PYPY_PV=${PV%_p*}
43 +MY_P=pypy3.9-v${PYPY_PV/_rc/rc}
44 +PATCHSET="pypy3.9-gentoo-patches-${PV/_rc/rc}"
45 +
46 +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.9) language"
47 +HOMEPAGE="https://www.pypy.org/"
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"
58 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
59 +IUSE="bzip2 gdbm +jit ncurses sqlite test 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 + gdbm? ( sys-libs/gdbm:0= )
72 + sqlite? ( dev-db/sqlite:3= )
73 + tk? (
74 + dev-lang/tk:0=
75 + dev-tcltk/tix:0=
76 + )
77 + !<dev-python/pypy3-bin-7.3.0:0
78 +"
79 +DEPEND="
80 + ${RDEPEND}
81 + test? (
82 + ${PYTHON_DEPS}
83 + !!dev-python/pytest-forked
84 + )
85 +"
86 +
87 +pkg_setup() {
88 + use test && python-any-r1_pkg_setup
89 +}
90 +
91 +src_prepare() {
92 + local PATCHES=(
93 + "${WORKDIR}/${PATCHSET}"
94 + )
95 + default
96 +
97 + eapply_user
98 +}
99 +
100 +src_configure() {
101 + tc-export CC
102 +}
103 +
104 +src_compile() {
105 + mkdir bin || die
106 + # switch to the layout expected for cffi module builds
107 + mkdir include/pypy3.9 || die
108 + # copy over to make sys.prefix happy
109 + cp -p "${BROOT}"/usr/bin/pypy3.9-c-${PYPY_PV} pypy3.9-c || die
110 + cp -p "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/* include/pypy3.9/ || die
111 + # (not installed by pypy-exe)
112 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
113 + mv pypy/module/cpyext/include/* include/pypy3.9/ || die
114 + mv pypy/module/cpyext/parse/*.h include/pypy3.9/ || die
115 + pax-mark m pypy3.9-c
116 +
117 + # verify the subslot
118 + local soabi=$(
119 + ./pypy3.9-c - <<-EOF
120 + import sysconfig
121 + print(sysconfig.get_config_var("SOABI"))
122 + EOF
123 + )
124 + [[ ${soabi} == ${SLOT#*/} ]] || die "update subslot to ${soabi}"
125 +
126 + einfo "Generating caches and CFFI modules ..."
127 +
128 + # Generate Grammar and PatternGrammar pickles.
129 + ./pypy3.9-c - <<-EOF || die "Generation of Grammar and PatternGrammar pickles failed"
130 + import lib2to3.pygram
131 + import lib2to3.patcomp
132 + lib2to3.patcomp.PatternCompiler()
133 + EOF
134 +
135 + # Generate cffi modules
136 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
137 + # (NB: we build CFFI modules first to avoid error log when importing
138 + # build_cffi_imports).
139 + cffi_targets=( pypy_util blake2/_blake2 sha3/_sha3 ssl
140 + audioop syslog pwdgrp resource lzma posixshmem )
141 + use gdbm && cffi_targets+=( gdbm )
142 + use ncurses && cffi_targets+=( curses )
143 + use sqlite && cffi_targets+=( sqlite3 )
144 + use tk && cffi_targets+=( tkinter/tklib )
145 +
146 + local t
147 + # all modules except tkinter output to .
148 + # tkinter outputs to the correct dir ...
149 + cd lib_pypy || die
150 + for t in "${cffi_targets[@]}"; do
151 + # tkinter doesn't work via -m
152 + ../pypy3.9-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
153 + done
154 +
155 + # Verify that CFFI module list is up-to-date
156 + local expected_cksum=63d4659f
157 + local local_cksum=$(
158 + ../pypy3.9-c - <<-EOF
159 + import binascii
160 + import json
161 + from pypy_tools.build_cffi_imports import cffi_build_scripts as x
162 + print("%08x" % (binascii.crc32(json.dumps(x).encode()),))
163 + EOF
164 + )
165 + if [[ ${local_cksum} != ${expected_cksum} ]]; then
166 + die "Please verify cffi_targets and update checksum to ${local_cksum}"
167 + fi
168 +
169 + # Cleanup temporary objects
170 + find -name "*_cffi.[co]" -delete || die
171 + find -type d -empty -delete || die
172 +}
173 +
174 +src_test() {
175 + # (unset)
176 + local -x PYTHONDONTWRITEBYTECODE=
177 + local -x COLUMNS=80
178 +
179 + # Test runner requires Python 2 too. However, it spawns PyPy3
180 + # internally so that we end up testing the correct interpreter.
181 + # (--deselect for failing doctests)
182 + "${EPYTHON}" ./pypy/test_all.py --pypy=./pypy3.9-c -vv lib-python || die
183 +}
184 +
185 +src_install() {
186 + einfo "Installing PyPy ..."
187 + dodir /usr/bin
188 + dosym pypy3.9-c-${PYPY_PV} /usr/bin/pypy3.9
189 + dosym pypy3.9 /usr/bin/pypy3
190 + insinto /usr/lib/pypy3.9
191 + # preserve mtimes to avoid obsoleting caches
192 + insopts -p
193 + doins -r lib-python/3/. lib_pypy/.
194 + insinto /usr/include
195 + doins -r include/pypy3.9
196 +
197 + # replace copied headers with symlinks
198 + for x in "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/*; do
199 + dosym "${PYPY_PV}/${x##*/}" "/usr/include/pypy3.9/${x##*/}"
200 + done
201 +
202 + dodoc README.rst
203 +
204 + local dest=/usr/lib/pypy3.9
205 + if ! use gdbm; then
206 + rm -r "${ED}${dest}"/_gdbm* || die
207 + fi
208 + if ! use sqlite; then
209 + rm -r "${ED}${dest}"/sqlite3 \
210 + "${ED}${dest}"/_sqlite3* \
211 + "${ED}${dest}"/test/test_sqlite.py || die
212 + fi
213 + if ! use tk; then
214 + rm -r "${ED}${dest}"/{idlelib,tkinter} \
215 + "${ED}${dest}"/_tkinter \
216 + "${ED}${dest}"/test/test_{tcl,tk,ttk*}.py || die
217 + fi
218 +
219 + local -x EPYTHON=pypy3
220 + local -x PYTHON=${ED}/usr/bin/pypy3.9-c-${PYPY_PV}
221 + # temporarily copy to build tree to facilitate module builds
222 + cp -p "${BROOT}/usr/bin/pypy3.9-c-${PYPY_PV}" "${PYTHON}" || die
223 +
224 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
225 + python_moduleinto "${dest}"/site-packages
226 + python_domodule epython.py
227 +
228 + einfo "Byte-compiling Python standard library..."
229 + python_optimize "${ED}${dest}"
230 +
231 + # remove to avoid collisions
232 + rm "${PYTHON}" || die
233 +}