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