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