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: Wed, 12 Oct 2016 21:00:06
Message-Id: 1476305989.dc1e49b2a80467a5bbe89cd2212513f42b921862.mgorny@gentoo
1 commit: dc1e49b2a80467a5bbe89cd2212513f42b921862
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 12 18:50:35 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 12 20:59:49 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc1e49b2
7
8 dev-python/pypy3: Bump to 5.5.0 (alpha)
9
10 dev-python/pypy3/Manifest | 1 +
11 dev-python/pypy3/pypy3-5.5.0_alpha.ebuild | 254 ++++++++++++++++++++++++++++++
12 2 files changed, 255 insertions(+)
13
14 diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
15 index f4bfa46..6335aa6 100644
16 --- a/dev-python/pypy3/Manifest
17 +++ b/dev-python/pypy3/Manifest
18 @@ -1,3 +1,4 @@
19 DIST pypy3-2.4.0-src.tar.bz2 14693194 SHA256 d9ba207d6eecf8a0dc4414e9f4e92db1abd143e8cc6ec4a6bdcac75b29f104f3 SHA512 7e2b0c21f1833b8cd61251c2d58c6a9f99207e5d582618f0036886ff28dcb313541dce1c36bd1b57b332a36a94b13e416bb7b67110be7c8ece8283749ba712be WHIRLPOOL bd02009c828b7b491b46b260d687d268561e5372766adccbcb58e87a3f1c545f293c54e5cdd6e6b7fb95feb678677137211ee890f106140ce1bc256f8563d2cd
20 DIST pypy3.3-v5.2.0-alpha1-src.tar.bz2 24390595 SHA256 344c2f088c82ea1274964bb0505ab80d3f9e538cc03f91aa109325ddbaa61426 SHA512 1b6bcab12a7f4dd0ac44158b8acafd64de4b9bcc277385ba4c05982381dcd577fa6ec7b2247f70d2671055f3669764b92b4447b32d51ded58c60e6ec23509595 WHIRLPOOL 9455686af04f31da52da812e4f48d773c1ce45180ba067a308a779fa8b468b5a10c446a28d7468e61278801837705e882240a2e17884bc94069e564a5706f177
21 +DIST pypy3.3-v5.5.0-alpha-src.tar.bz2 25122033 SHA256 d5591c34d77253e9ed57d182b6f49585b95f7c09c3e121f0e8630e5a7e75ab5f SHA512 b2cf9700e45c452293297edffe08e572dffc3c567026b4b5d9165c1ba1b4d858ffc8a6754f5f28781020016c36440e5c02d07562d075b12444c9c32ea5dd2168 WHIRLPOOL 6bde174969413c55d6d077cd14e737c4f034f19935536af1bffaf3a1caa456d2bf6850760a18c274ad99089bd5ab7331d7d185f914cd6c69f708abf857d35df3
22 DIST python-gentoo-patches-3.3.5-0.tar.xz 12892 SHA256 a7240de9598033cb40f8f273d8104d4e2b1dcaea028d45ac28efaa3c680ff6f7 SHA512 27eef4c2b3f631b000db3f6a5c426d9b498d63a08fe82b1ab7c2c010fb72208109461a5f008d47703852526655b70a734ea95be8742897026db5750bb9cc9d16 WHIRLPOOL edab9222d7da94cab3b1de0e1a27c6c7dbd49194b813a0a1cf9e532063029c4e4f19151c9f4878eeabed3168ff1f97eae7f008280c7ed2897fc14c5516c68d7e
23
24 diff --git a/dev-python/pypy3/pypy3-5.5.0_alpha.ebuild b/dev-python/pypy3/pypy3-5.5.0_alpha.ebuild
25 new file mode 100644
26 index 00000000..d3a46f6
27 --- /dev/null
28 +++ b/dev-python/pypy3/pypy3-5.5.0_alpha.ebuild
29 @@ -0,0 +1,254 @@
30 +# Copyright 1999-2016 Gentoo Foundation
31 +# Distributed under the terms of the GNU General Public License v2
32 +# $Id$
33 +
34 +EAPI=5
35 +
36 +# pypy3 needs to be built using python 2
37 +PYTHON_COMPAT=( python2_7 pypy )
38 +inherit check-reqs eutils multilib multiprocessing pax-utils python-any-r1 toolchain-funcs versionator
39 +
40 +CPY_PATCHSET_VERSION="3.3.5-0"
41 +
42 +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.3) language"
43 +HOMEPAGE="http://pypy.org/"
44 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PV/_/-}-src.tar.bz2
45 + https://dev.gentoo.org/~floppym/python-gentoo-patches-${CPY_PATCHSET_VERSION}.tar.xz"
46 +
47 +LICENSE="MIT"
48 +# XX from pypy3-XX.so module suffix
49 +SLOT="0/55"
50 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
51 +IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox +shadowstack sqlite cpu_flags_x86_sse2 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:0 )
70 + !low-memory? ( ${PYTHON_DEPS} )"
71 +# doc? ( dev-python/sphinx )
72 +
73 +# Who would care about predictable directory names?
74 +S="${WORKDIR}/pypy3-v${PV%_*}-src"
75 +
76 +pkg_pretend() {
77 + if [[ ${MERGE_TYPE} != binary ]]; then
78 + if use low-memory; then
79 + CHECKREQS_MEMORY="1750M"
80 + use amd64 && CHECKREQS_MEMORY="3500M"
81 + else
82 + CHECKREQS_MEMORY="3G"
83 + use amd64 && CHECKREQS_MEMORY="6G"
84 + fi
85 +
86 + check-reqs_pkg_pretend
87 + fi
88 +}
89 +
90 +pkg_setup() {
91 + if [[ ${MERGE_TYPE} != binary ]]; then
92 + pkg_pretend
93 +
94 + # unset to allow forcing pypy below :)
95 + use low-memory && local EPYTHON=
96 + if python_is_installed pypy && [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]]; then
97 + einfo "Using PyPy to perform the translation."
98 + local EPYTHON=pypy
99 + else
100 + einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
101 + einfo "recommends using PyPy for that. If you wish to do so, please install"
102 + einfo "virtual/pypy and ensure that EPYTHON variable is unset."
103 + fi
104 +
105 + python-any-r1_pkg_setup
106 + fi
107 +}
108 +
109 +src_prepare() {
110 + epatch "${FILESDIR}/4.0.0-gentoo-path.patch" \
111 + "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" \
112 + "${FILESDIR}"/2.5.0-shared-lib.patch # 517002
113 +
114 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
115 + -e "s^@libdir@^$(get_libdir)^" \
116 + -i lib-python/3/distutils/command/install.py || die
117 +
118 + # apply CPython stdlib patches
119 + pushd lib-python/3 > /dev/null || die
120 + epatch "${FILESDIR}"/5.2.0-distutils-c++.patch \
121 + "${WORKDIR}"/patches/24_all_sqlite-3.8.4.patch
122 + popd > /dev/null || die
123 +
124 + epatch_user
125 +}
126 +
127 +src_compile() {
128 + tc-export CC
129 +
130 + local jit_backend
131 + if use jit; then
132 + jit_backend='--jit-backend='
133 +
134 + # We only need the explicit sse2 switch for x86.
135 + # On other arches we can rely on autodetection which uses
136 + # compiler macros. Plus, --jit-backend= doesn't accept all
137 + # the modern values...
138 +
139 + if use x86; then
140 + if use cpu_flags_x86_sse2; then
141 + jit_backend+=x86
142 + else
143 + jit_backend+=x86-without-sse2
144 + fi
145 + else
146 + jit_backend+=auto
147 + fi
148 + fi
149 +
150 + local args=(
151 + --shared
152 + $(usex jit -Ojit -O2)
153 + $(usex shadowstack --gcrootfinder=shadowstack '')
154 + $(usex sandbox --sandbox '')
155 +
156 + ${jit_backend}
157 + --make-jobs=$(makeopts_jobs)
158 +
159 + pypy/goal/targetpypystandalone
160 + )
161 +
162 + # Avoid linking against libraries disabled by use flags
163 + local opts=(
164 + bzip2:bz2
165 + ncurses:_minimal_curses
166 + )
167 +
168 + local opt
169 + for opt in "${opts[@]}"; do
170 + local flag=${opt%:*}
171 + local mod=${opt#*:}
172 +
173 + args+=(
174 + $(usex ${flag} --withmod --withoutmod)-${mod}
175 + )
176 + done
177 +
178 + local interp=( "${PYTHON}" )
179 + if use low-memory; then
180 + interp=( env PYPY_GC_MAX_DELTA=200MB
181 + "${PYTHON}" --jit loop_longevity=300 )
182 + fi
183 +
184 + set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}"
185 + echo -e "\033[1m${@}\033[0m"
186 + "${@}" || die "compile error"
187 +
188 + # Exception occurred:
189 + # File "/tmp/1/pypy3-2.4.0-src/pypy/config/makerestdoc.py", line 199, in config_role
190 + # assert txt.check()
191 + # AssertionError
192 + #use doc && emake -C pypy/doc/ html
193 + pax-mark m pypy-c libpypy-c.so
194 +}
195 +
196 +src_test() {
197 + # (unset)
198 + local -x PYTHONDONTWRITEBYTECODE
199 +
200 + # Test runner requires Python 2 too. However, it spawns PyPy3
201 + # internally so that we end up testing the correct interpreter.
202 + "${PYTHON}" ./pypy/test_all.py --pypy=./pypy-c lib-python || die
203 +}
204 +
205 +src_install() {
206 + local dest=/usr/$(get_libdir)/pypy3
207 + einfo "Installing PyPy ..."
208 + insinto "${dest}"
209 + doins -r include lib_pypy lib-python pypy-c libpypy-c.so
210 + fperms a+x ${dest}/pypy-c ${dest}/libpypy-c.so
211 + pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so"
212 + dosym ../$(get_libdir)/pypy3/pypy-c /usr/bin/pypy3
213 + dodoc README.rst
214 +
215 + if ! use gdbm; then
216 + rm -r "${ED%/}${dest}"/lib_pypy/gdbm.py \
217 + "${ED%/}${dest}"/lib-python/*3/test/test_gdbm.py || die
218 + fi
219 + if ! use sqlite; then
220 + rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
221 + "${ED%/}${dest}"/lib_pypy/_sqlite3.py \
222 + "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
223 + fi
224 + if ! use tk; then
225 + rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
226 + "${ED%/}${dest}"/lib_pypy/_tkinter \
227 + "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
228 + fi
229 +
230 + # Install docs
231 + #use doc && dohtml -r pypy/doc/_build/html/
232 +
233 + einfo "Generating caches and byte-compiling ..."
234 +
235 + local -x PYTHON=${ED%/}${dest}/pypy-c
236 + local -x LD_LIBRARY_PATH="${ED%/}${dest}"
237 + # we can't use eclass function since PyPy is dumb and always gives
238 + # paths relative to the interpreter
239 + local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy3/site-packages
240 + python_export pypy3 EPYTHON
241 +
242 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
243 + python_domodule epython.py
244 +
245 + # Generate Grammar and PatternGrammar pickles.
246 + "${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
247 + || die "Generation of Grammar and PatternGrammar pickles failed"
248 +
249 + # Generate cffi modules
250 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
251 +#cffi_build_scripts = {
252 +# "sqlite3": "_sqlite3_build.py",
253 +# "audioop": "_audioop_build.py",
254 +# "tk": "_tkinter/tklib_build.py",
255 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
256 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
257 +# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
258 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
259 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
260 +# "lzma": "_lzma_build.py",
261 +# "_decimal": "_decimal_build.py",
262 + cffi_targets=( audioop syslog pwdgrp resource lzma decimal )
263 + use gdbm && cffi_targets+=( gdbm )
264 + use ncurses && cffi_targets+=( curses )
265 + use sqlite && cffi_targets+=( sqlite3 )
266 + use tk && cffi_targets+=( tkinter/tklib )
267 +
268 + local t
269 + # all modules except tkinter output to .
270 + # tkinter outputs to the correct dir ...
271 + cd "${ED%/}${dest}"/lib_pypy || die
272 + for t in "${cffi_targets[@]}"; do
273 + # tkinter doesn't work via -m
274 + "${PYTHON}" "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
275 + done
276 +
277 + # Cleanup temporary objects
278 + find "${ED%/}${dest}" -name "_cffi_*.[co]" -delete || die
279 + find "${ED%/}${dest}" -type d -empty -delete || die
280 +
281 + # compile the installed modules
282 + python_optimize "${ED%/}${dest}"
283 +}