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