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