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/pypy3/
Date: Sun, 21 Apr 2019 06:30:02
Message-Id: 1555828192.3e54d40120e8b27a6bf94eadfa1b8395edb03c7f.mgorny@gentoo
1 commit: 3e54d40120e8b27a6bf94eadfa1b8395edb03c7f
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 19 11:39:59 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=3e54d401
7
8 dev-python/pypy3: Bump to 7.1.1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy3/Manifest | 1 +
13 dev-python/pypy3/pypy3-7.1.1.ebuild | 250 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 251 insertions(+)
15
16 diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
17 index d504fd7a9eb..40244f11480 100644
18 --- a/dev-python/pypy3/Manifest
19 +++ b/dev-python/pypy3/Manifest
20 @@ -1,3 +1,4 @@
21 DIST pypy3-v6.0.0-src.tar.bz2 22648140 BLAKE2B b8678859b0c24494788ddf6f410a3ec1a56a04663452e1aba25d3f41c5073a95866d1623f00cb1a6c9d0256df728fa60d1edb5b58d26c0d88577769cc8a6205d SHA512 ea406c4dd1837a6ab13026de01330790f3c18f6e2bfb83e8553e52acf78b43dfb559ce75c2d91395055c771db359356c8183ed950da6f01a21bf09128935af5e
22 DIST pypy3.5-v7.0.0-src.tar.bz2 22730690 BLAKE2B 312aea1f88303b225bbfa5e82a28d3c2893d9977b03a3fd12923db15c4a77f04ec3fbce947f0684c4e27073836583ef8a5eaf5be05612e564172170740c2a6e3 SHA512 3facac26e06e254cbf244841824b35ec211859123f6ba9f095dc980292c10d9cf1d11de62cc6372cf77e92ee1cd2358bbd794b3ff25cb7172e1b21c02c8ce6c2
23 DIST pypy3.6-v7.1.0-src.tar.bz2 23167216 BLAKE2B 12a085c2d4820289643818d8bc1c17304e4cf4f4687054452d878c6f26fd36802bbbe5baee73f0ce2f0322e126dbccbcf7b48ca6569bb7eb8d59f473bd80d4b1 SHA512 1a0a9e9de31c63114c0537747c4a718504a28b780a2ef1f76bff6051a1ec68b496b574989f0b729c07611cd81e199135dd268834dfa6f9664e1e119db8ae20e4
24 +DIST pypy3.6-v7.1.1-src.tar.bz2 23171982 BLAKE2B be43528bc6f3e02d146016a4969bd8c7a9e880a3bd3b77f441aac6d22ef67700f71e0171ec000066bd2c0bd506db64af69d6b75b59a92222dd0353ee70e6629b SHA512 17e78f9c7080d597a6283d8e8247d1ca78f09a14ff221db8c3d90d255b5befc73102b317ca34a80979e544d5ee72f3e5e649f89d185a085f4cc15012da4d0473
25
26 diff --git a/dev-python/pypy3/pypy3-7.1.1.ebuild b/dev-python/pypy3/pypy3-7.1.1.ebuild
27 new file mode 100644
28 index 00000000000..f0f7cdf74a2
29 --- /dev/null
30 +++ b/dev-python/pypy3/pypy3-7.1.1.ebuild
31 @@ -0,0 +1,250 @@
32 +# Copyright 1999-2019 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +# pypy3 needs to be built using python 2
38 +PYTHON_COMPAT=( python2_7 pypy )
39 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
40 +
41 +MY_P=pypy3.6-v${PV}
42 +
43 +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.6) language"
44 +HOMEPAGE="http://pypy.org/"
45 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
46 +
47 +LICENSE="MIT"
48 +# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
49 +SLOT="0/71-py36"
50 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
51 +IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox sqlite 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/pypy3-bin:0"
68 +DEPEND="${RDEPEND}
69 + low-memory? ( virtual/pypy )
70 + !low-memory? (
71 + || (
72 + virtual/pypy
73 + (
74 + dev-lang/python:2.7
75 + dev-python/pycparser[python_targets_python2_7(-),python_single_target_python2_7(+)]
76 + )
77 + )
78 + )"
79 +
80 +S="${WORKDIR}/${MY_P}-src"
81 +
82 +check_env() {
83 + if use low-memory; then
84 + CHECKREQS_MEMORY="1750M"
85 + use amd64 && CHECKREQS_MEMORY="3500M"
86 + else
87 + CHECKREQS_MEMORY="3G"
88 + use amd64 && CHECKREQS_MEMORY="6G"
89 + fi
90 +
91 + check-reqs_pkg_pretend
92 +}
93 +
94 +pkg_pretend() {
95 + [[ ${MERGE_TYPE} != binary ]] && check_env
96 +}
97 +
98 +pkg_setup() {
99 + if [[ ${MERGE_TYPE} != binary ]]; then
100 + check_env
101 +
102 + # unset to allow forcing pypy below :)
103 + use low-memory && local EPYTHON=
104 + if python_is_installed pypy && [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]]; then
105 + einfo "Using PyPy to perform the translation."
106 + local EPYTHON=pypy
107 + else
108 + einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
109 + einfo "recommends using PyPy for that. If you wish to do so, please install"
110 + einfo "virtual/pypy and ensure that EPYTHON variable is unset."
111 + fi
112 +
113 + python-any-r1_pkg_setup
114 + fi
115 +}
116 +
117 +src_prepare() {
118 + eapply "${FILESDIR}/7.0.0-gentoo-path.patch"
119 + eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
120 + eapply "${FILESDIR}"/5.9.0-shared-lib.patch # 517002
121 + eapply "${FILESDIR}"/7.0.0_all_distutils_cxx.patch
122 +
123 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
124 + -i lib-python/3/distutils/command/install.py || die
125 +
126 + # apply CPython stdlib patches
127 + pushd lib-python/3 > /dev/null || die
128 + eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
129 + popd > /dev/null || die
130 +
131 + eapply_user
132 +}
133 +
134 +src_configure() {
135 + tc-export CC
136 +
137 + local args=(
138 + --shared
139 + $(usex jit -Ojit -O2)
140 + $(usex sandbox --sandbox '')
141 +
142 + --jit-backend=auto
143 +
144 + pypy/goal/targetpypystandalone
145 + )
146 +
147 + # Avoid linking against libraries disabled by use flags
148 + local opts=(
149 + bzip2:bz2
150 + ncurses:_minimal_curses
151 + )
152 +
153 + local opt
154 + for opt in "${opts[@]}"; do
155 + local flag=${opt%:*}
156 + local mod=${opt#*:}
157 +
158 + args+=(
159 + $(usex ${flag} --withmod --withoutmod)-${mod}
160 + )
161 + done
162 +
163 + local interp=( "${PYTHON}" )
164 + if use low-memory; then
165 + interp=( env PYPY_GC_MAX_DELTA=200MB
166 + "${PYTHON}" --jit loop_longevity=300 )
167 + fi
168 +
169 + # translate into the C sources
170 + # we're going to make them ourselves since otherwise pypy does not
171 + # free up the unneeded memory before spawning the compiler
172 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
173 + echo -e "\033[1m${@}\033[0m"
174 + "${@}" || die "translation failed"
175 +}
176 +
177 +src_compile() {
178 + emake -C "${T}"/usession*-0/testing_1
179 +
180 + # copy back to make sys.prefix happy
181 + cp -p "${T}"/usession*-0/testing_1/{pypy3-c,libpypy3-c.so} . || die
182 + pax-mark m pypy3-c libpypy3-c.so
183 +
184 + einfo "Generating caches and CFFI modules ..."
185 +
186 + # Generate Grammar and PatternGrammar pickles.
187 + ./pypy3-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
188 + || die "Generation of Grammar and PatternGrammar pickles failed"
189 +
190 + # Generate cffi modules
191 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
192 +#cffi_build_scripts = {
193 +# "sqlite3": "_sqlite3_build.py",
194 +# "audioop": "_audioop_build.py",
195 +# "tk": "_tkinter/tklib_build.py",
196 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
197 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
198 +# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
199 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
200 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
201 +# "lzma": "_lzma_build.py",
202 +# "_decimal": "_decimal_build.py",
203 +# "_ssl": "_ssl_build.py",
204 +# "_blake2": "_blake2/_blake2_build.py",
205 +# "_sha3": "_sha3/_sha3_build.py",
206 + cffi_targets=( blake2/_blake2 sha3/_sha3 ssl
207 + audioop syslog pwdgrp resource lzma decimal )
208 + use gdbm && cffi_targets+=( gdbm )
209 + use ncurses && cffi_targets+=( curses )
210 + use sqlite && cffi_targets+=( sqlite3 )
211 + use tk && cffi_targets+=( tkinter/tklib )
212 +
213 + einfo "Please disregard the import errors during CFFI cache generation."
214 + einfo "They come from modules not built yet."
215 +
216 + local t
217 + # all modules except tkinter output to .
218 + # tkinter outputs to the correct dir ...
219 + cd lib_pypy || die
220 + for t in "${cffi_targets[@]}"; do
221 + # tkinter doesn't work via -m
222 + ../pypy3-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
223 + done
224 +
225 + # Cleanup temporary objects
226 + find -name "_cffi_*.[co]" -delete || die
227 + find -type d -empty -delete || die
228 +}
229 +
230 +src_test() {
231 + # (unset)
232 + local -x PYTHONDONTWRITEBYTECODE=
233 +
234 + # Test runner requires Python 2 too. However, it spawns PyPy3
235 + # internally so that we end up testing the correct interpreter.
236 + "${PYTHON}" ./pypy/test_all.py --pypy=./pypy3-c -vv lib-python || die
237 +}
238 +
239 +src_install() {
240 + local dest=/usr/lib/pypy3.6
241 + einfo "Installing PyPy ..."
242 + exeinto "${dest}"
243 + doexe pypy3-c libpypy3-c.so
244 + pax-mark m "${ED%/}${dest}/pypy3-c" "${ED%/}${dest}/libpypy3-c.so"
245 + insinto "${dest}"
246 + # preserve mtimes to avoid obsoleting caches
247 + insopts -p
248 + doins -r include lib_pypy lib-python
249 + dosym ../lib/pypy3.6/pypy3-c /usr/bin/pypy3
250 + dodoc README.rst
251 +
252 + if ! use gdbm; then
253 + rm -r "${ED%/}${dest}"/lib_pypy/_gdbm* || die
254 + fi
255 + if ! use sqlite; then
256 + rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
257 + "${ED%/}${dest}"/lib_pypy/_sqlite3* \
258 + "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
259 + fi
260 + if ! use tk; then
261 + rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
262 + "${ED%/}${dest}"/lib_pypy/_tkinter \
263 + "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
264 + fi
265 +
266 + einfo "Generating caches and byte-compiling ..."
267 +
268 + local -x PYTHON=${ED%/}${dest}/pypy3-c
269 + # we can't use eclass function since PyPy is dumb and always gives
270 + # paths relative to the interpreter
271 + local PYTHON_SITEDIR=${EPREFIX}/usr/lib/pypy3.6/site-packages
272 + python_export pypy3 EPYTHON
273 +
274 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
275 + python_domodule epython.py
276 +
277 + einfo "Byte-compiling Python standard library..."
278 +
279 + # compile the installed modules
280 + python_optimize "${ED%/}${dest}"
281 +}