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, 14 Dec 2019 11:58:19
Message-Id: 1576324690.d057517187600cd3d28c2878091ceb0f35868396.mgorny@gentoo
1 commit: d057517187600cd3d28c2878091ceb0f35868396
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 14 11:52:51 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 14 11:58:10 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0575171
7
8 dev-python/pypy: Bump to 7.3.0rc1
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.0_rc1.ebuild | 286 ++++++++++++++++++++++++++++++++++
14 2 files changed, 287 insertions(+)
15
16 diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
17 index 6b99efadd91..df43ead4e80 100644
18 --- a/dev-python/pypy/Manifest
19 +++ b/dev-python/pypy/Manifest
20 @@ -1,2 +1,3 @@
21 DIST pypy2.7-v7.2.0-src.tar.bz2 20219532 BLAKE2B 225e2cebdfa3ceb310f2a047b1d9e1d375b181c10707822890f39fc0a5ec9e6ddd7a8cf6e073074067960b766a0a813294042513a08b8e7e02b011f612e17917 SHA512 8f724490f9fa06686c8e25ddd3592b260bbffae460395de4c7d29d983780ce9b8925fa87434aac6446aac2034381cc1a13074faf252f5d1ac466a252f219f1ae
22 +DIST pypy2.7-v7.3.0rc1-src.tar.bz2 20416611 BLAKE2B acb971ec6db423d32aba9691672ff04257d4188d73852577a924305238ac16c71370e23e4a8da38b309e3e280baeb58cfa21a94a5b7252c0a1e54db5fd27dd2b SHA512 f24de1766da15cdf98333c8ac1942c14ab1990de23df2910c2cb0e63f65bcd1c72545f6c9913175aea53a17e9a65dd302a80fd3d424665c99c372fb6bd179807
23 DIST python-gentoo-patches-2.7.15.tar.xz 16208 BLAKE2B 5739c2b3a236d48f8e33f0fe6515bfe7a8f99096f6223b402653988feac2513d37d26b6e40e5e049852f42657358170e468ca60097e0e2294e760787c12ad591 SHA512 687fd008d1d41b1e65ce5417f6f6aba84ffd42f7af44ef97c03a7806b28e6888f8df043a0c15187a8b229cc17642853e6feb25494db97f4d10f8a66f8ebcbcca
24
25 diff --git a/dev-python/pypy/pypy-7.3.0_rc1.ebuild b/dev-python/pypy/pypy-7.3.0_rc1.ebuild
26 new file mode 100644
27 index 00000000000..4dda5f32fd2
28 --- /dev/null
29 +++ b/dev-python/pypy/pypy-7.3.0_rc1.ebuild
30 @@ -0,0 +1,286 @@
31 +# Copyright 1999-2019 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +PYTHON_COMPAT=( python2_7 pypy )
37 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
38 +
39 +# note: remember to update this to newest dev-lang/python:2.7 on bump
40 +CPY_PATCHSET_VERSION="2.7.15"
41 +MY_P=pypy2.7-v${PV/_/}
42 +
43 +DESCRIPTION="A fast, compliant alternative implementation of the Python language"
44 +HOMEPAGE="https://pypy.org/"
45 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2
46 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${CPY_PATCHSET_VERSION}.tar.xz"
47 +
48 +LICENSE="MIT"
49 +# pypy -c 'import sysconfig; print sysconfig.get_config_var("SOABI")'
50 +SLOT="0/73"
51 +KEYWORDS=""
52 +IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox sqlite cpu_flags_x86_sse2 tk"
53 +
54 +RDEPEND=">=sys-libs/zlib-1.1.3:0=
55 + virtual/libffi:0=
56 + virtual/libintl:0=
57 + dev-libs/expat:0=
58 + !libressl? ( dev-libs/openssl:0= )
59 + libressl? ( dev-libs/libressl:0= )
60 + bzip2? ( app-arch/bzip2:0= )
61 + gdbm? ( sys-libs/gdbm:0= )
62 + ncurses? ( sys-libs/ncurses: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:0"
69 +# don't enforce the dep on pypy with USE=low-memory since it's going
70 +# to cause either collisions or circular dep on itself
71 +DEPEND="${RDEPEND}
72 + !low-memory? (
73 + || (
74 + dev-python/pypy
75 + dev-python/pypy-bin
76 + (
77 + dev-lang/python:2.7
78 + dev-python/pycparser[python_targets_python2_7(-),python_single_target_python2_7(+)]
79 + )
80 + )
81 + )"
82 +
83 +S="${WORKDIR}/${MY_P}-src"
84 +
85 +check_env() {
86 + if use low-memory; then
87 + if ! python_is_installed pypy; then
88 + eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
89 + eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:"
90 + eerror
91 + eerror " $ emerge -1v dev-python/pypy-bin"
92 + eerror
93 + eerror "before attempting to build dev-python/pypy[low-memory]."
94 + die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory"
95 + fi
96 +
97 + CHECKREQS_MEMORY="1750M"
98 + use amd64 && CHECKREQS_MEMORY="3500M"
99 + else
100 + CHECKREQS_MEMORY="3G"
101 + use amd64 && CHECKREQS_MEMORY="6G"
102 + fi
103 +
104 + check-reqs_pkg_pretend
105 +}
106 +
107 +pkg_pretend() {
108 + [[ ${MERGE_TYPE} != binary ]] && check_env
109 +}
110 +
111 +pkg_setup() {
112 + if [[ ${MERGE_TYPE} != binary ]]; then
113 + check_env
114 +
115 + if python_is_installed pypy; then
116 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] || use low-memory; then
117 + einfo "Using already-installed PyPy to perform the translation."
118 + local EPYTHON=pypy
119 + else
120 + einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
121 + einfo "recommends using PyPy for that. If you wish to do so, please unset"
122 + einfo "the EPYTHON variable."
123 + fi
124 + fi
125 +
126 + python-any-r1_pkg_setup
127 + fi
128 +}
129 +
130 +src_prepare() {
131 + eapply "${FILESDIR}/7.0.0-gentoo-path.patch"
132 + eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
133 + eapply "${FILESDIR}"/5.9.0-shared-lib.patch # 517002
134 +
135 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
136 + -i lib-python/2.7/distutils/command/install.py || die
137 +
138 + # apply CPython stdlib patches
139 + pushd lib-python/2.7 > /dev/null || die
140 + # TODO: cpy turkish locale patch now fixes C code
141 + # probably needs better port to pypy, if it is broken there
142 + eapply "${FILESDIR}"/5.8.0_all_distutils_cxx.patch
143 + eapply -p2 "${WORKDIR}"/patches/0011-use_pyxml.patch
144 + popd > /dev/null || die
145 +
146 + eapply_user
147 +}
148 +
149 +src_configure() {
150 + tc-export CC
151 +
152 + local jit_backend
153 + if use jit; then
154 + jit_backend='--jit-backend='
155 +
156 + # We only need the explicit sse2 switch for x86.
157 + # On other arches we can rely on autodetection which uses
158 + # compiler macros. Plus, --jit-backend= doesn't accept all
159 + # the modern values...
160 +
161 + if use x86; then
162 + if use cpu_flags_x86_sse2; then
163 + jit_backend+=x86
164 + else
165 + jit_backend+=x86-without-sse2
166 + fi
167 + else
168 + jit_backend+=auto
169 + fi
170 + fi
171 +
172 + local args=(
173 + --shared
174 + $(usex jit -Ojit -O2)
175 + $(usex sandbox --sandbox '')
176 +
177 + ${jit_backend}
178 +
179 + pypy/goal/targetpypystandalone
180 + )
181 +
182 + # Avoid linking against libraries disabled by use flags
183 + local opts=(
184 + bzip2:bz2
185 + ncurses:_minimal_curses
186 + )
187 +
188 + local opt
189 + for opt in "${opts[@]}"; do
190 + local flag=${opt%:*}
191 + local mod=${opt#*:}
192 +
193 + args+=(
194 + $(usex ${flag} --withmod --withoutmod)-${mod}
195 + )
196 + done
197 +
198 + local interp=( "${PYTHON}" )
199 + if use low-memory; then
200 + interp=( env PYPY_GC_MAX_DELTA=200MB
201 + "${PYTHON}" --jit loop_longevity=300 )
202 + fi
203 +
204 + # translate into the C sources
205 + # we're going to make them ourselves since otherwise pypy does not
206 + # free up the unneeded memory before spawning the compiler
207 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
208 + echo -e "\033[1m${@}\033[0m"
209 + "${@}" || die "translation failed"
210 +}
211 +
212 +src_compile() {
213 + emake -C "${T}"/usession*-0/testing_1
214 +
215 + # copy back to make sys.prefix happy
216 + cp -p "${T}"/usession*-0/testing_1/{pypy-c,libpypy-c.so} . || die
217 + pax-mark m pypy-c libpypy-c.so
218 +
219 + einfo "Generating caches and CFFI modules ..."
220 +
221 + # Generate Grammar and PatternGrammar pickles.
222 + ./pypy-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
223 + || die "Generation of Grammar and PatternGrammar pickles failed"
224 +
225 + # Generate cffi modules
226 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
227 +#cffi_build_scripts = {
228 +# "_ssl": "_ssl_build.py",
229 +# "sqlite3": "_sqlite3_build.py",
230 +# "audioop": "_audioop_build.py",
231 +# "tk": "_tkinter/tklib_build.py",
232 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
233 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
234 +# "gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
235 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
236 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
237 + cffi_targets=( ssl audioop syslog pwdgrp resource )
238 + use gdbm && cffi_targets+=( gdbm )
239 + use ncurses && cffi_targets+=( curses )
240 + use sqlite && cffi_targets+=( sqlite3 )
241 + use tk && cffi_targets+=( tkinter/tklib )
242 +
243 + local t
244 + # all modules except tkinter output to .
245 + # tkinter outputs to the correct dir ...
246 + cd lib_pypy || die
247 + for t in "${cffi_targets[@]}"; do
248 + # tkinter doesn't work via -m
249 + ../pypy-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
250 + done
251 +
252 + # Cleanup temporary objects
253 + find -name "_cffi_*.[co]" -delete || die
254 + find -type d -empty -delete || die
255 +}
256 +
257 +src_test() {
258 + # (unset)
259 + local -x PYTHONDONTWRITEBYTECODE=
260 +
261 + local ignored_tests=(
262 + # network
263 + --ignore=lib-python/2.7/test/test_urllibnet.py
264 + --ignore=lib-python/2.7/test/test_urllib2net.py
265 + # lots of free space
266 + --ignore=lib-python/2.7/test/test_zipfile64.py
267 + # no module named 'worker' -- a lot
268 + --ignore=lib-python/2.7/test/test_xpickle.py
269 + )
270 +
271 + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -vv \
272 + "${ignored_tests[@]}" lib-python || die
273 +}
274 +
275 +src_install() {
276 + local dest=/usr/lib/pypy2.7
277 + einfo "Installing PyPy ..."
278 + exeinto "${dest}"
279 + doexe pypy-c libpypy-c.so
280 + pax-mark m "${ED}${dest}/pypy-c" "${ED}${dest}/libpypy-c.so"
281 + insinto "${dest}"
282 + # preserve mtimes to avoid obsoleting caches
283 + insopts -p
284 + doins -r include lib_pypy lib-python
285 + dosym ../lib/pypy2.7/pypy-c /usr/bin/pypy
286 + dodoc README.rst
287 +
288 + if ! use gdbm; then
289 + rm -r "${ED}${dest}"/lib_pypy/gdbm.py \
290 + "${ED}${dest}"/lib-python/*2.7/test/test_gdbm.py || die
291 + fi
292 + if ! use sqlite; then
293 + rm -r "${ED}${dest}"/lib-python/*2.7/sqlite3 \
294 + "${ED}${dest}"/lib_pypy/_sqlite3.py \
295 + "${ED}${dest}"/lib-python/*2.7/test/test_sqlite.py || die
296 + fi
297 + if ! use tk; then
298 + rm -r "${ED}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \
299 + "${ED}${dest}"/lib_pypy/_tkinter \
300 + "${ED}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die
301 + fi
302 +
303 + local -x PYTHON=${ED}${dest}/pypy-c
304 + # we can't use eclass function since PyPy is dumb and always gives
305 + # paths relative to the interpreter
306 + local PYTHON_SITEDIR=${EPREFIX}/usr/lib/pypy2.7/site-packages
307 + python_export pypy EPYTHON
308 +
309 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
310 + python_domodule epython.py
311 +
312 + einfo "Byte-compiling Python standard library..."
313 +
314 + # compile the installed modules
315 + python_optimize "${ED}${dest}"
316 +}