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: Sat, 19 Jun 2021 19:19:01
Message-Id: 1624130333.4eaeacf78fae8b08be3b86a781bee737adf478ef.mgorny@gentoo
1 commit: 4eaeacf78fae8b08be3b86a781bee737adf478ef
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 19 19:02:53 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 19 19:18:53 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4eaeacf7
7
8 dev-python/pypy: Backport secfix to 7.3.4_p1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy/Manifest | 1 +
13 dev-python/pypy/pypy-7.3.4_p1.ebuild | 160 +++++++++++++++++++++++++++++++++++
14 2 files changed, 161 insertions(+)
15
16 diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
17 index 7b09b3316a2..c44f9b30441 100644
18 --- a/dev-python/pypy/Manifest
19 +++ b/dev-python/pypy/Manifest
20 @@ -1,4 +1,5 @@
21 DIST pypy2.7-gentoo-patches-7.3.4.tar.xz 7844 BLAKE2B d06694fa085667e40ef8805c29f7ccf95b49f9de4e99e3ebfa3d69c4202a0ddcebb54c524d7d9f9ec67573a8d2ebe38fb7023d4d3ecef67afc907ecef5c16c02 SHA512 aa8ffefb5d30070ae86c1c14c55c277e39d3da66aea3a0951319158fb65e716e7fa7864e8bf5d26314d4b2a8030c766b63cad6a3663822d2875cd8cc1f3f2de5
22 +DIST pypy2.7-gentoo-patches-7.3.4_p1.tar.xz 8880 BLAKE2B dbf76e26b38187aafc5d60ee6189148d6211624689d5c6151d9c77ea5d744774db1bdf7230f97da16623045525449eeefc9d6ead168d8fdb166593c203918601 SHA512 78ed998ec6b8f2ac4bdd381496477d5e337841b1d7da0e77bd39a4748d3dd1a08ac6353561ca618d4cade24d26756ff4c221459162bc532e6597b8e9c7cd8d62
23 DIST pypy2.7-gentoo-patches-7.3.5rc3.tar.xz 5796 BLAKE2B b1c0fb0a8d86d117a9d4102777605eedd026b614f4b66272b3fc5da246bbe5edf516e95a40471117b61078c18b9fc615e55e0992a5d0a1be7caf9026ee26b6be SHA512 8699813837dfa4560a6e73b96f770c5d5999ce008e17cf62a856a454cb0b63146787a54934874162c79345488959e0936b3bd03823bc9f8e276f80df1122f7a8
24 DIST pypy2.7-v7.3.4-src.tar.bz2 21571561 BLAKE2B d0ac56fadec63fe7e65728c36c2aaf96fc5f54919dddbca9571a24c42a9e3e21f672f84555a18a384c4715f0489bd7aef009c0a47b635de88c472a93e2ae8d71 SHA512 4c18c2dbfbf0cc1034bea773828204df77aec7ef82119fb94e5cb762ce1783e00ad70e99d1432b4948dc132e726bdc6015f4a5bf10a5b10415bcfe99da2ecd17
25 DIST pypy2.7-v7.3.5rc3-src.tar.bz2 21563312 BLAKE2B e343dcd617026ea5f951f3d24deeb59736c9a6ecc91d1b9c1bd980b6f3c239a5bf0edb9b72a0847a6aeeaead8aca9ecf537af81c9fcf0a2f6647c99edc0d1735 SHA512 e080771ea10a30820f8844b3f512a7681f2e619e8a37fa8ac60198f3c8c3780a8e08aa63749be375c00cd547994f428df44e2cd9f61b272b215ded433374e0a1
26
27 diff --git a/dev-python/pypy/pypy-7.3.4_p1.ebuild b/dev-python/pypy/pypy-7.3.4_p1.ebuild
28 new file mode 100644
29 index 00000000000..193e85b762a
30 --- /dev/null
31 +++ b/dev-python/pypy/pypy-7.3.4_p1.ebuild
32 @@ -0,0 +1,160 @@
33 +# Copyright 1999-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +inherit pax-utils python-utils-r1
39 +
40 +PYPY_PV=${PV%_p*}
41 +MY_P=pypy2.7-v${PYPY_PV}
42 +PATCHSET="pypy2.7-gentoo-patches-${PV}"
43 +
44 +DESCRIPTION="A fast, compliant alternative implementation of the Python 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 +# pypy -c 'import sysconfig; print sysconfig.get_config_var("SOABI")'
52 +SLOT="0/73"
53 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
54 +IUSE="bzip2 gdbm +jit ncurses sqlite tk"
55 +
56 +RDEPEND="
57 + || (
58 + >=dev-python/pypy-exe-${PYPY_PV}:${PYPY_PV}[bzip2?,ncurses?]
59 + >=dev-python/pypy-exe-bin-${PYPY_PV}:${PYPY_PV}
60 + )
61 + dev-libs/openssl:0=
62 + gdbm? ( sys-libs/gdbm:0= )
63 + sqlite? ( dev-db/sqlite:3= )
64 + tk? (
65 + dev-lang/tk:0=
66 + dev-tcltk/tix:0=
67 + )
68 + !<dev-python/pypy-bin-7.3.0:0"
69 +DEPEND="${RDEPEND}"
70 +
71 +src_prepare() {
72 + local PATCHES=(
73 + "${WORKDIR}/${PATCHSET}"
74 + )
75 + default
76 +
77 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
78 + -i lib-python/2.7/distutils/command/install.py || die
79 +}
80 +
81 +src_compile() {
82 + # copy over to make sys.prefix happy
83 + cp -p "${BROOT}"/usr/lib/pypy2.7/pypy-c-${PYPY_PV} pypy-c || die
84 + cp -p "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/* include/ || die
85 + # (not installed by pypy)
86 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
87 + mv pypy/module/cpyext/include/* include/ || die
88 + mv pypy/module/cpyext/parse/*.h include/ || die
89 + pax-mark m pypy-c
90 +
91 + einfo "Generating caches and CFFI modules ..."
92 +
93 + # Generate Grammar and PatternGrammar pickles.
94 + ./pypy-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
95 + || die "Generation of Grammar and PatternGrammar pickles failed"
96 +
97 + # Generate cffi modules
98 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
99 +#cffi_build_scripts = {
100 +# "_ssl": "_ssl_build.py",
101 +# "sqlite3": "_sqlite3_build.py",
102 +# "audioop": "_audioop_build.py",
103 +# "tk": "_tkinter/tklib_build.py",
104 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
105 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
106 +# "gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
107 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
108 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
109 + cffi_targets=( ssl audioop syslog pwdgrp resource )
110 + use gdbm && cffi_targets+=( gdbm )
111 + use ncurses && cffi_targets+=( curses )
112 + use sqlite && cffi_targets+=( sqlite3 )
113 + use tk && cffi_targets+=( tkinter/tklib )
114 +
115 + local t
116 + # all modules except tkinter output to .
117 + # tkinter outputs to the correct dir ...
118 + cd lib_pypy || die
119 + for t in "${cffi_targets[@]}"; do
120 + # tkinter doesn't work via -m
121 + ../pypy-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
122 + done
123 +
124 + # Cleanup temporary objects
125 + find -name "_cffi_*.[co]" -delete || die
126 + find -type d -empty -delete || die
127 +}
128 +
129 +src_test() {
130 + # (unset)
131 + local -x PYTHONDONTWRITEBYTECODE=
132 + local -x COLUMNS=80
133 +
134 + local ignored_tests=(
135 + # network
136 + --ignore=lib-python/2.7/test/test_urllibnet.py
137 + --ignore=lib-python/2.7/test/test_urllib2net.py
138 + # lots of free space
139 + --ignore=lib-python/2.7/test/test_zipfile64.py
140 + )
141 +
142 + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -vv \
143 + "${ignored_tests[@]}" lib-python || die
144 +}
145 +
146 +src_install() {
147 + local dest=/usr/lib/pypy2.7
148 + einfo "Installing PyPy ..."
149 + dosym pypy-c-${PYPY_PV} "${dest}/pypy-c"
150 + insinto "${dest}"
151 + # preserve mtimes to avoid obsoleting caches
152 + insopts -p
153 + doins -r include lib_pypy lib-python
154 +
155 + # replace copied headers with symlinks
156 + for x in "${BROOT}"/usr/lib/pypy2.7/include/${PYPY_PV}/*; do
157 + dosym "${PYPY_PV}/${x##*/}" "${dest}/include/${x##*/}"
158 + done
159 +
160 + dosym ../lib/pypy2.7/pypy-c /usr/bin/pypy
161 + dodoc README.rst
162 +
163 + if ! use gdbm; then
164 + rm -r "${ED}${dest}"/lib_pypy/gdbm.py \
165 + "${ED}${dest}"/lib-python/*2.7/test/test_gdbm.py || die
166 + fi
167 + if ! use sqlite; then
168 + rm -r "${ED}${dest}"/lib-python/*2.7/sqlite3 \
169 + "${ED}${dest}"/lib_pypy/_sqlite3.py \
170 + "${ED}${dest}"/lib-python/*2.7/test/test_sqlite.py || die
171 + fi
172 + if ! use tk; then
173 + rm -r "${ED}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \
174 + "${ED}${dest}"/lib_pypy/_tkinter \
175 + "${ED}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die
176 + fi
177 +
178 + local -x EPYTHON=pypy
179 + local -x PYTHON=${ED}${dest}/pypy-c-${PYPY_PV}
180 + # temporarily copy to build tree to facilitate module builds
181 + cp -p "${BROOT}${dest}/pypy-c-${PYPY_PV}" "${PYTHON}" || die
182 +
183 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
184 + python_moduleinto /usr/lib/pypy2.7/site-packages
185 + python_domodule epython.py
186 +
187 + einfo "Byte-compiling Python standard library..."
188 + python_optimize "${ED}${dest}"
189 +
190 + # remove to avoid collisions
191 + rm "${PYTHON}" || die
192 +}