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