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