1 |
commit: 08e74d16429dc1976bd8fa2f241df29fd314e675 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 26 15:20:43 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 27 06:34:29 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08e74d16 |
7 |
|
8 |
dev-python/pypy: Bump to 6.0.0 |
9 |
|
10 |
dev-python/pypy/Manifest | 1 + |
11 |
dev-python/pypy/pypy-6.0.0.ebuild | 275 ++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 276 insertions(+) |
13 |
|
14 |
diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest |
15 |
index f88e142d58d..2557dd1c6be 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.9.0-src.tar.bz2 19175394 BLAKE2B 0d5fa0d013d8cdb9765bf0f535877894d7a3544c19481973f788187251d1bd2ba11f88950430e85c7608ea394cc952ae7dd7275b9843397ab098e153cf96ec7f SHA512 3170747e81088043c6a4885bd0bc92e911556420b6c2539a4ed7e62956f1c741651f772def0fb00d8826a1bef9d6f4e79a13682a4456a31d987f7c9bd8608a4d |
21 |
+DIST pypy2-v6.0.0-src.tar.bz2 19741694 BLAKE2B 55f5000e590613b516b12c3682a658fe6a17fbe264be3d61a81698cdf098b39177cf4355eb3f28980209c7a0e005498201cbad8884e3aa02cc86a228d1552046 SHA512 d3bdcd65fc83f2fda3203a604733fe6765049a17cca2715cd6045dc302a6159b4741a821c53fa4c97acf7297cef4c62e941a6a6eb7f8a253a93a28dcf2aa2ca0 |
22 |
DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1 |
23 |
|
24 |
diff --git a/dev-python/pypy/pypy-6.0.0.ebuild b/dev-python/pypy/pypy-6.0.0.ebuild |
25 |
new file mode 100644 |
26 |
index 00000000000..286b7be69e1 |
27 |
--- /dev/null |
28 |
+++ b/dev-python/pypy/pypy-6.0.0.ebuild |
29 |
@@ -0,0 +1,275 @@ |
30 |
+# Copyright 1999-2018 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 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 |
+ !low-memory? ( |
72 |
+ || ( |
73 |
+ dev-python/pypy |
74 |
+ dev-python/pypy-bin |
75 |
+ ( |
76 |
+ dev-lang/python:2.7 |
77 |
+ dev-python/pycparser[python_targets_python2_7(-),python_single_target_python2_7(+)] |
78 |
+ ) |
79 |
+ ) |
80 |
+ )" |
81 |
+ |
82 |
+S="${WORKDIR}/${MY_P}-src" |
83 |
+ |
84 |
+check_env() { |
85 |
+ if use low-memory; then |
86 |
+ if ! python_is_installed pypy; then |
87 |
+ eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy" |
88 |
+ eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:" |
89 |
+ eerror |
90 |
+ eerror " $ emerge -1v dev-python/pypy-bin" |
91 |
+ eerror |
92 |
+ eerror "before attempting to build dev-python/pypy[low-memory]." |
93 |
+ die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory" |
94 |
+ fi |
95 |
+ |
96 |
+ CHECKREQS_MEMORY="1750M" |
97 |
+ use amd64 && CHECKREQS_MEMORY="3500M" |
98 |
+ else |
99 |
+ CHECKREQS_MEMORY="3G" |
100 |
+ use amd64 && CHECKREQS_MEMORY="6G" |
101 |
+ fi |
102 |
+ |
103 |
+ check-reqs_pkg_pretend |
104 |
+} |
105 |
+ |
106 |
+pkg_pretend() { |
107 |
+ [[ ${MERGE_TYPE} != binary ]] && check_env |
108 |
+} |
109 |
+ |
110 |
+pkg_setup() { |
111 |
+ if [[ ${MERGE_TYPE} != binary ]]; then |
112 |
+ check_env |
113 |
+ |
114 |
+ if python_is_installed pypy; then |
115 |
+ if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] || use low-memory; then |
116 |
+ einfo "Using already-installed PyPy to perform the translation." |
117 |
+ local EPYTHON=pypy |
118 |
+ else |
119 |
+ einfo "Using ${EPYTHON} to perform the translation. Please note that upstream" |
120 |
+ einfo "recommends using PyPy for that. If you wish to do so, please unset" |
121 |
+ einfo "the EPYTHON variable." |
122 |
+ fi |
123 |
+ fi |
124 |
+ |
125 |
+ python-any-r1_pkg_setup |
126 |
+ fi |
127 |
+} |
128 |
+ |
129 |
+src_prepare() { |
130 |
+ eapply "${FILESDIR}/4.0.0-gentoo-path.patch" |
131 |
+ eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" |
132 |
+ eapply "${FILESDIR}"/5.9.0-shared-lib.patch # 517002 |
133 |
+ |
134 |
+ sed -e "s^@EPREFIX@^${EPREFIX}^" \ |
135 |
+ -e "s^@libdir@^$(get_libdir)^" \ |
136 |
+ -i lib-python/2.7/distutils/command/install.py || die |
137 |
+ |
138 |
+ # apply CPython stdlib patches |
139 |
+ pushd lib-python/2.7 > /dev/null || die |
140 |
+ # TODO: cpy turkish locale patch now fixes C code |
141 |
+ # probably needs better port to pypy, if it is broken there |
142 |
+ eapply "${FILESDIR}"/5.8.0_all_distutils_cxx.patch |
143 |
+ eapply "${WORKDIR}"/patches/62_all_xml.use_pyxml.patch |
144 |
+ popd > /dev/null || die |
145 |
+ |
146 |
+ eapply_user |
147 |
+} |
148 |
+ |
149 |
+src_configure() { |
150 |
+ tc-export CC |
151 |
+ |
152 |
+ local jit_backend |
153 |
+ if use jit; then |
154 |
+ jit_backend='--jit-backend=' |
155 |
+ |
156 |
+ # We only need the explicit sse2 switch for x86. |
157 |
+ # On other arches we can rely on autodetection which uses |
158 |
+ # compiler macros. Plus, --jit-backend= doesn't accept all |
159 |
+ # the modern values... |
160 |
+ |
161 |
+ if use x86; then |
162 |
+ if use cpu_flags_x86_sse2; then |
163 |
+ jit_backend+=x86 |
164 |
+ else |
165 |
+ jit_backend+=x86-without-sse2 |
166 |
+ fi |
167 |
+ else |
168 |
+ jit_backend+=auto |
169 |
+ fi |
170 |
+ fi |
171 |
+ |
172 |
+ local args=( |
173 |
+ --shared |
174 |
+ $(usex jit -Ojit -O2) |
175 |
+ $(usex sandbox --sandbox '') |
176 |
+ |
177 |
+ ${jit_backend} |
178 |
+ |
179 |
+ pypy/goal/targetpypystandalone |
180 |
+ ) |
181 |
+ |
182 |
+ # Avoid linking against libraries disabled by use flags |
183 |
+ local opts=( |
184 |
+ bzip2:bz2 |
185 |
+ ncurses:_minimal_curses |
186 |
+ ) |
187 |
+ |
188 |
+ local opt |
189 |
+ for opt in "${opts[@]}"; do |
190 |
+ local flag=${opt%:*} |
191 |
+ local mod=${opt#*:} |
192 |
+ |
193 |
+ args+=( |
194 |
+ $(usex ${flag} --withmod --withoutmod)-${mod} |
195 |
+ ) |
196 |
+ done |
197 |
+ |
198 |
+ local interp=( "${PYTHON}" ) |
199 |
+ if use low-memory; then |
200 |
+ interp=( env PYPY_GC_MAX_DELTA=200MB |
201 |
+ "${PYTHON}" --jit loop_longevity=300 ) |
202 |
+ fi |
203 |
+ |
204 |
+ # translate into the C sources |
205 |
+ # we're going to make them ourselves since otherwise pypy does not |
206 |
+ # free up the unneeded memory before spawning the compiler |
207 |
+ set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}" |
208 |
+ echo -e "\033[1m${@}\033[0m" |
209 |
+ "${@}" || die "translation failed" |
210 |
+} |
211 |
+ |
212 |
+src_compile() { |
213 |
+ emake -C "${T}"/usession*-0/testing_1 |
214 |
+ |
215 |
+ # copy back to make sys.prefix happy |
216 |
+ cp -p "${T}"/usession*-0/testing_1/{pypy-c,libpypy-c.so} . || die |
217 |
+ pax-mark m pypy-c libpypy-c.so |
218 |
+ |
219 |
+ einfo "Generating caches and CFFI modules ..." |
220 |
+ |
221 |
+ # Generate Grammar and PatternGrammar pickles. |
222 |
+ ./pypy-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \ |
223 |
+ || die "Generation of Grammar and PatternGrammar pickles failed" |
224 |
+ |
225 |
+ # Generate cffi modules |
226 |
+ # Please keep in sync with pypy/tool/build_cffi_imports.py! |
227 |
+#cffi_build_scripts = { |
228 |
+# "sqlite3": "_sqlite3_build.py", |
229 |
+# "audioop": "_audioop_build.py", |
230 |
+# "tk": "_tkinter/tklib_build.py", |
231 |
+# "curses": "_curses_build.py" if sys.platform != "win32" else None, |
232 |
+# "syslog": "_syslog_build.py" if sys.platform != "win32" else None, |
233 |
+# "gdbm": "_gdbm_build.py" if sys.platform != "win32" else None, |
234 |
+# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None, |
235 |
+# "resource": "_resource_build.py" if sys.platform != "win32" else None, |
236 |
+ cffi_targets=( audioop syslog pwdgrp resource ) |
237 |
+ use gdbm && cffi_targets+=( gdbm ) |
238 |
+ use ncurses && cffi_targets+=( curses ) |
239 |
+ use sqlite && cffi_targets+=( sqlite3 ) |
240 |
+ use tk && cffi_targets+=( tkinter/tklib ) |
241 |
+ |
242 |
+ local t |
243 |
+ # all modules except tkinter output to . |
244 |
+ # tkinter outputs to the correct dir ... |
245 |
+ cd lib_pypy || die |
246 |
+ for t in "${cffi_targets[@]}"; do |
247 |
+ # tkinter doesn't work via -m |
248 |
+ ../pypy-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}" |
249 |
+ done |
250 |
+ |
251 |
+ # Cleanup temporary objects |
252 |
+ find -name "_cffi_*.[co]" -delete || die |
253 |
+ find -type d -empty -delete || die |
254 |
+} |
255 |
+ |
256 |
+src_test() { |
257 |
+ # (unset) |
258 |
+ local -x PYTHONDONTWRITEBYTECODE |
259 |
+ |
260 |
+ ./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die |
261 |
+} |
262 |
+ |
263 |
+src_install() { |
264 |
+ local dest=/usr/$(get_libdir)/pypy |
265 |
+ einfo "Installing PyPy ..." |
266 |
+ exeinto "${dest}" |
267 |
+ doexe pypy-c libpypy-c.so |
268 |
+ pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so" |
269 |
+ insinto "${dest}" |
270 |
+ # preserve mtimes to avoid obsoleting caches |
271 |
+ insopts -p |
272 |
+ doins -r include lib_pypy lib-python |
273 |
+ dosym ../$(get_libdir)/pypy/pypy-c /usr/bin/pypy |
274 |
+ dodoc README.rst |
275 |
+ |
276 |
+ if ! use gdbm; then |
277 |
+ rm -r "${ED%/}${dest}"/lib_pypy/gdbm.py \ |
278 |
+ "${ED%/}${dest}"/lib-python/*2.7/test/test_gdbm.py || die |
279 |
+ fi |
280 |
+ if ! use sqlite; then |
281 |
+ rm -r "${ED%/}${dest}"/lib-python/*2.7/sqlite3 \ |
282 |
+ "${ED%/}${dest}"/lib_pypy/_sqlite3.py \ |
283 |
+ "${ED%/}${dest}"/lib-python/*2.7/test/test_sqlite.py || die |
284 |
+ fi |
285 |
+ if ! use tk; then |
286 |
+ rm -r "${ED%/}${dest}"/lib-python/*2.7/{idlelib,lib-tk} \ |
287 |
+ "${ED%/}${dest}"/lib_pypy/_tkinter \ |
288 |
+ "${ED%/}${dest}"/lib-python/*2.7/test/test_{tcl,tk,ttk*}.py || die |
289 |
+ fi |
290 |
+ |
291 |
+ local -x PYTHON=${ED%/}${dest}/pypy-c |
292 |
+ # we can't use eclass function since PyPy is dumb and always gives |
293 |
+ # paths relative to the interpreter |
294 |
+ local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy/site-packages |
295 |
+ python_export pypy EPYTHON |
296 |
+ |
297 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
298 |
+ python_domodule epython.py |
299 |
+ |
300 |
+ einfo "Byte-compiling Python standard library..." |
301 |
+ |
302 |
+ # compile the installed modules |
303 |
+ python_optimize "${ED%/}${dest}" |
304 |
+} |