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: Wed, 27 Dec 2017 18:20:42
Message-Id: 1514398826.c33ec3a4bb0d527b2e09f13ddd89339f99678776.mgorny@gentoo
1 commit: c33ec3a4bb0d527b2e09f13ddd89339f99678776
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 27 11:31:48 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 27 18:20:26 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c33ec3a4
7
8 dev-python/pypy: Bump to 5.10.0
9
10 dev-python/pypy/Manifest | 1 +
11 dev-python/pypy/pypy-5.10.0.ebuild | 281 +++++++++++++++++++++++++++++++++++++
12 2 files changed, 282 insertions(+)
13
14 diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
15 index 03ac25c05e6..ad7d1d11ef4 100644
16 --- a/dev-python/pypy/Manifest
17 +++ b/dev-python/pypy/Manifest
18 @@ -1,3 +1,4 @@
19 +DIST pypy2-v5.10.0-src.tar.bz2 19181430 BLAKE2B 4a0808c74fb167a7e98625f1d5b8559bb3a0383445387a0c48f951d75d009c57806eb600a141a84a7cb800e2f53fe091367cbb0b23192bc52b995cb65246c076 SHA512 11892418d753ddc59e928a5f59b3406b7c22b8689ad6995eeb183182dbb5184117e68bb567c770ffa60a14d6763550d658e260584e65da5025ed481f48501379
20 DIST pypy2-v5.8.0-src.tar.bz2 19163498 BLAKE2B 377971cf9e9a5ea75966937e9f22fe24d149af28678947d33356333fe67c8295cf07bf2dac3e7b45d265fef6126d8ebb23aee132e3b43d872bd61ec1ddf17a2c SHA512 222c6ce11b00830e310b766df4c145b7f554f23b87fc6146f214d758d7a6159c5c00af475aa7fa630ef4c37b52cdf2fd73049b6ec3610715b6abc0a925fe1365
21 DIST pypy2-v5.9.0-src.tar.bz2 19175394 BLAKE2B 0d5fa0d013d8cdb9765bf0f535877894d7a3544c19481973f788187251d1bd2ba11f88950430e85c7608ea394cc952ae7dd7275b9843397ab098e153cf96ec7f SHA512 3170747e81088043c6a4885bd0bc92e911556420b6c2539a4ed7e62956f1c741651f772def0fb00d8826a1bef9d6f4e79a13682a4456a31d987f7c9bd8608a4d
22 DIST python-gentoo-patches-2.7.13-0.tar.xz 13292 BLAKE2B cf60845f320f46b6be3755a50bb24b8c55478caaa86877f35015f4187eadaaa2f0e95216f04eca3c9c3fe8347ca3b82c529435033e7935f32067ad45cca5d18f SHA512 d70f6baba1a465a752c515e33dfdee2a5cc75400fadfb8ea0bd1e82d50089abdf02d7726c697850dc47de2054aa494bbdc08de2673c260b54e609f29dab259ad
23
24 diff --git a/dev-python/pypy/pypy-5.10.0.ebuild b/dev-python/pypy/pypy-5.10.0.ebuild
25 new file mode 100644
26 index 00000000000..7cfed8fcca3
27 --- /dev/null
28 +++ b/dev-python/pypy/pypy-5.10.0.ebuild
29 @@ -0,0 +1,281 @@
30 +# Copyright 1999-2017 Gentoo Foundation
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=6
34 +
35 +PYTHON_COMPAT=( python2_7 pypy )
36 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs versionator
37 +
38 +# note: remember to update this to newest dev-lang/python:2.7 on bump
39 +CPY_PATCHSET_VERSION="2.7.14-0"
40 +MY_P=pypy2-v${PV}
41 +
42 +DESCRIPTION="A fast, compliant alternative implementation of the Python language"
43 +HOMEPAGE="http://pypy.org/"
44 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2
45 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${CPY_PATCHSET_VERSION}.tar.xz"
46 +
47 +LICENSE="MIT"
48 +# pypy -c 'import sysconfig; print sysconfig.get_config_var("SOABI")'
49 +SLOT="0/41"
50 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
51 +IUSE="bzip2 doc gdbm +jit libressl low-memory ncurses sandbox sqlite cpu_flags_x86_sse2 test tk"
52 +
53 +RDEPEND=">=sys-libs/zlib-1.1.3:0=
54 + virtual/libffi:0=
55 + virtual/libintl:0=
56 + dev-libs/expat:0=
57 + !libressl? ( dev-libs/openssl:0=[-bindist] )
58 + libressl? ( dev-libs/libressl:0= )
59 + bzip2? ( app-arch/bzip2:0= )
60 + gdbm? ( sys-libs/gdbm:0= )
61 + ncurses? ( sys-libs/ncurses:0= )
62 + sqlite? ( dev-db/sqlite:3= )
63 + tk? (
64 + dev-lang/tk:0=
65 + dev-tcltk/tix:0=
66 + )
67 + !dev-python/pypy-bin:0"
68 +# don't enforce the dep on pypy with USE=low-memory since it's going
69 +# to cause either collisions or circular dep on itself
70 +DEPEND="${RDEPEND}
71 + doc? ( dev-python/sphinx )
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}/4.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 + -e "s^@libdir@^$(get_libdir)^" \
137 + -i lib-python/2.7/distutils/command/install.py || die
138 +
139 + # apply CPython stdlib patches
140 + pushd lib-python/2.7 > /dev/null || die
141 + # TODO: cpy turkish locale patch now fixes C code
142 + # probably needs better port to pypy, if it is broken there
143 + eapply "${FILESDIR}"/5.8.0_all_distutils_cxx.patch
144 + eapply "${WORKDIR}"/patches/62_all_xml.use_pyxml.patch
145 + popd > /dev/null || die
146 +
147 + eapply_user
148 +}
149 +
150 +src_configure() {
151 + tc-export CC
152 +
153 + local jit_backend
154 + if use jit; then
155 + jit_backend='--jit-backend='
156 +
157 + # We only need the explicit sse2 switch for x86.
158 + # On other arches we can rely on autodetection which uses
159 + # compiler macros. Plus, --jit-backend= doesn't accept all
160 + # the modern values...
161 +
162 + if use x86; then
163 + if use cpu_flags_x86_sse2; then
164 + jit_backend+=x86
165 + else
166 + jit_backend+=x86-without-sse2
167 + fi
168 + else
169 + jit_backend+=auto
170 + fi
171 + fi
172 +
173 + local args=(
174 + --shared
175 + $(usex jit -Ojit -O2)
176 + $(usex sandbox --sandbox '')
177 +
178 + ${jit_backend}
179 +
180 + pypy/goal/targetpypystandalone
181 + )
182 +
183 + # Avoid linking against libraries disabled by use flags
184 + local opts=(
185 + bzip2:bz2
186 + ncurses:_minimal_curses
187 + )
188 +
189 + local opt
190 + for opt in "${opts[@]}"; do
191 + local flag=${opt%:*}
192 + local mod=${opt#*:}
193 +
194 + args+=(
195 + $(usex ${flag} --withmod --withoutmod)-${mod}
196 + )
197 + done
198 +
199 + local interp=( "${PYTHON}" )
200 + if use low-memory; then
201 + interp=( env PYPY_GC_MAX_DELTA=200MB
202 + "${PYTHON}" --jit loop_longevity=300 )
203 + fi
204 +
205 + # translate into the C sources
206 + # we're going to make them ourselves since otherwise pypy does not
207 + # free up the unneeded memory before spawning the compiler
208 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
209 + echo -e "\033[1m${@}\033[0m"
210 + "${@}" || die "translation failed"
211 +}
212 +
213 +src_compile() {
214 + emake -C "${T}"/usession*-0/testing_1
215 +
216 + # copy back to make sys.prefix happy
217 + cp -p "${T}"/usession*-0/testing_1/{pypy-c,libpypy-c.so} . || die
218 + pax-mark m pypy-c libpypy-c.so
219 +
220 + use doc && emake -C pypy/doc html
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 + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die
264 +}
265 +
266 +src_install() {
267 + local dest=/usr/$(get_libdir)/pypy
268 + einfo "Installing PyPy ..."
269 + exeinto "${dest}"
270 + doexe pypy-c libpypy-c.so
271 + pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so"
272 + insinto "${dest}"
273 + # preserve mtimes to avoid obsoleting caches
274 + insopts -p
275 + doins -r include lib_pypy lib-python
276 + dosym ../$(get_libdir)/pypy/pypy-c /usr/bin/pypy
277 + dodoc README.rst
278 +
279 + if ! use gdbm; then
280 + rm -r "${ED%/}${dest}"/lib_pypy/gdbm.py \
281 + "${ED%/}${dest}"/lib-python/*2.7/test/test_gdbm.py || die
282 + fi
283 + if ! use sqlite; then
284 + rm -r "${ED%/}${dest}"/lib-python/*2.7/sqlite3 \
285 + "${ED%/}${dest}"/lib_pypy/_sqlite3.py \
286 + "${ED%/}${dest}"/lib-python/*2.7/test/test_sqlite.py || die
287 + fi
288 + if ! use tk; then
289 + rm -r "${ED%/}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \
290 + "${ED%/}${dest}"/lib_pypy/_tkinter \
291 + "${ED%/}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die
292 + fi
293 +
294 + # Install docs
295 + use doc && dodoc -r pypy/doc/_build/html
296 +
297 + local -x PYTHON=${ED%/}${dest}/pypy-c
298 + # we can't use eclass function since PyPy is dumb and always gives
299 + # paths relative to the interpreter
300 + local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy/site-packages
301 + python_export pypy EPYTHON
302 +
303 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
304 + python_domodule epython.py
305 +
306 + einfo "Byte-compiling Python standard library..."
307 +
308 + # compile the installed modules
309 + python_optimize "${ED%/}${dest}"
310 +}