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-bin/
Date: Thu, 15 Aug 2019 11:24:05
Message-Id: 1565868238.76d8482bd7f496ca1b79204271e83b789eadd94a.mgorny@gentoo
1 commit: 76d8482bd7f496ca1b79204271e83b789eadd94a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 15 11:23:34 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 15 11:23:58 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76d8482b
7
8 dev-python/pypy3-bin: Rebuild no-sse2 x86 package
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy3-bin/Manifest | 1 +
13 dev-python/pypy3-bin/pypy3-bin-7.1.1-r1.ebuild | 188 +++++++++++++++++++++++++
14 2 files changed, 189 insertions(+)
15
16 diff --git a/dev-python/pypy3-bin/Manifest b/dev-python/pypy3-bin/Manifest
17 index f8f5694c26c..2ff35e7bb57 100644
18 --- a/dev-python/pypy3-bin/Manifest
19 +++ b/dev-python/pypy3-bin/Manifest
20 @@ -2,5 +2,6 @@ DIST pypy3-bin-7.1.1-amd64+bzip2+jit+ncurses.tar.lz 11031375 BLAKE2B e01ac298d3c
21 DIST pypy3-bin-7.1.1-amd64+bzip2+ncurses.tar.lz 6915836 BLAKE2B 0f3f2210e7f6e73872d32b2c01a911b52ad2a8c8987034709d9e4c72cfe11e422eea7b6522b19b3717876307d9fbbfbdfcc008dc2e3771dea083eeb61c202e6e SHA512 7fe6a19f56d7cdc142b368154e17af8936b8b730102c4a1c8a6b756a13b643d1375a51f45a0a3d345f7a8a23b75a81d35a6aa810129d231bf2091e156f69a914
22 DIST pypy3-bin-7.1.1-x86+bzip2+jit+ncurses+sse2.tar.lz 8540485 BLAKE2B a7de0db24e4bc56d54cbc03d618f8e08932e23a1fe5a1ab227600c244e222a6dae723c72fbd5cdd059c3e3f52bd355c4c9ee18506f6b39961bd1473358d35bd3 SHA512 f3355109bc073e220a33e8763c2d2ccf152d223d3850bb85aac71c19170ce4b118a84f258a829c486209f3c3014264384b158de17c9a0156c24afcf5b130a8e0
23 DIST pypy3-bin-7.1.1-x86+bzip2+ncurses+sse2.tar.lz 5523574 BLAKE2B 44f760842b0f232f7f5fb7a2fe3f60ff1f832dec3b0c16d1fd27ab36d09c12d6be8aa6727a880c3400506ea415317ddfb982439c1a581a03909099eeb6ea8cf6 SHA512 df664a7afa5bdd329d19046c81e362782c4f9358add2b7e54100df10a23434b9a341ec504ac1d49b2b017917937ab23ffd3cf723f86b65d7080789f795f5a4d3
24 +DIST pypy3-bin-7.1.1-x86+bzip2+ncurses.r1.tar.lz 5550959 BLAKE2B 72b1f84f0c70b07bd622b4d9ba67b165ce047037acc9a4fb46427b07db8793610f71dc389fc5cede209663c7d36750faf6247d5b6eb3be006c6cc58e4a94b0eb SHA512 3c522a9cf0e94aa8c14e9982a09231517c2c2b46e73a9c69bc6c43c44afefa3958de8879ac0fff2d43f8a0fc79117bdee645599d8e1d6a0def9806b44a4b1bc9
25 DIST pypy3-bin-7.1.1-x86+bzip2+ncurses.tar.lz 5545191 BLAKE2B 2afc40968977cd6956cb305a829811640e8437f0a811435a20ec694181286c94c820fd4148e3b6323a014ff391400d5265a7c1ee8b918c3db91ac02b44f3d585 SHA512 a1dad750491c5f524217986817a046c5c7a97b2b250a1d24b6a077d2d8067e249966cd331a5336fa2960a3d317c1aa83196c3e3b2f4a0734d79fe43cd9b55032
26 DIST pypy3.6-v7.1.1-src.tar.bz2 23171982 BLAKE2B be43528bc6f3e02d146016a4969bd8c7a9e880a3bd3b77f441aac6d22ef67700f71e0171ec000066bd2c0bd506db64af69d6b75b59a92222dd0353ee70e6629b SHA512 17e78f9c7080d597a6283d8e8247d1ca78f09a14ff221db8c3d90d255b5befc73102b317ca34a80979e544d5ee72f3e5e649f89d185a085f4cc15012da4d0473
27
28 diff --git a/dev-python/pypy3-bin/pypy3-bin-7.1.1-r1.ebuild b/dev-python/pypy3-bin/pypy3-bin-7.1.1-r1.ebuild
29 new file mode 100644
30 index 00000000000..453ae142dbd
31 --- /dev/null
32 +++ b/dev-python/pypy3-bin/pypy3-bin-7.1.1-r1.ebuild
33 @@ -0,0 +1,188 @@
34 +# Copyright 1999-2019 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +# Test runner needs Python 2.
40 +PYTHON_COMPAT=( python2_7 pypy )
41 +inherit pax-utils python-any-r1 unpacker
42 +
43 +BINHOST="https://dev.gentoo.org/~mgorny/dist/pypy3-bin/${PV}"
44 +MY_P=pypy3.6-v${PV}
45 +
46 +DESCRIPTION="A fast, compliant alternative implementation of Python 3.6 (binary package)"
47 +HOMEPAGE="http://pypy.org/"
48 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2
49 + amd64? (
50 + jit? ( ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.lz )
51 + !jit? ( ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.lz )
52 + )
53 + x86? (
54 + cpu_flags_x86_sse2? (
55 + jit? ( ${BINHOST}/${P}-x86+bzip2+jit+ncurses+sse2.tar.lz )
56 + !jit? ( ${BINHOST}/${P}-x86+bzip2+ncurses+sse2.tar.lz )
57 + )
58 + !cpu_flags_x86_sse2? (
59 + !jit? ( ${BINHOST}/${P}-x86+bzip2+ncurses.r1.tar.lz )
60 + )
61 + )"
62 +
63 +# Supported variants
64 +REQUIRED_USE="x86? ( !cpu_flags_x86_sse2? ( !jit ) )"
65 +
66 +LICENSE="MIT"
67 +# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
68 +SLOT="0/71-py36"
69 +KEYWORDS="~amd64 ~x86"
70 +IUSE="gdbm +jit libressl sqlite cpu_flags_x86_sse2 test tk"
71 +
72 +RDEPEND="
73 + app-arch/bzip2:0/1
74 + dev-libs/expat:0/0
75 + dev-libs/libffi:0/7
76 + sys-devel/gcc:*
77 + >=sys-libs/glibc-2.28
78 + sys-libs/ncurses:0/6
79 + sys-libs/zlib:0/1
80 + gdbm? ( sys-libs/gdbm:0= )
81 + !libressl? ( dev-libs/openssl:0=[-bindist] )
82 + libressl? ( dev-libs/libressl:0= )
83 + sqlite? ( dev-db/sqlite:3= )
84 + tk? (
85 + dev-lang/tk:0=
86 + dev-tcltk/tix:0=
87 + )
88 + !dev-python/pypy3:0"
89 +DEPEND="${RDEPEND}
90 + app-arch/lzip
91 + app-arch/xz-utils
92 + test? ( ${PYTHON_DEPS} )"
93 +
94 +S=${WORKDIR}/${MY_P}-src
95 +
96 +QA_PREBUILT="
97 + usr/lib/pypy3.6/pypy3-c
98 + usr/lib/pypy3.6/libpypy3-c.so"
99 +
100 +src_prepare() {
101 + eapply "${FILESDIR}/7.0.0-gentoo-path.patch"
102 + eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
103 + eapply "${FILESDIR}"/7.0.0_all_distutils_cxx.patch
104 +
105 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
106 + -i lib-python/3/distutils/command/install.py || die
107 +
108 + # apply CPython stdlib patches
109 + pushd lib-python/3 > /dev/null || die
110 + eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
111 + popd > /dev/null || die
112 +
113 + eapply_user
114 +}
115 +
116 +src_compile() {
117 + # Tadaam! PyPy compiled!
118 + mv "${WORKDIR}"/${P}*/{libpypy3-c.so,pypy3-c} . || die
119 + mv "${WORKDIR}"/${P}*/include/*.h include/ || die
120 + mv pypy/module/cpyext/include/*.h include/ || die
121 + mv pypy/module/cpyext/parse/*.h include/ || die
122 +
123 + pax-mark m pypy3-c libpypy3-c.so
124 +
125 + einfo "Generating caches and CFFI modules ..."
126 +
127 + # Generate Grammar and PatternGrammar pickles.
128 + ./pypy3-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
129 + || die "Generation of Grammar and PatternGrammar pickles failed"
130 +
131 + # Generate cffi modules
132 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
133 +#cffi_build_scripts = {
134 +# "sqlite3": "_sqlite3_build.py",
135 +# "audioop": "_audioop_build.py",
136 +# "tk": "_tkinter/tklib_build.py",
137 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
138 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
139 +# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
140 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
141 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
142 +# "lzma": "_lzma_build.py",
143 +# "_decimal": "_decimal_build.py",
144 +# "ssl": "_ssl_build.py",
145 +# "_blake2": "_blake2/_blake2_build.py",
146 +# "_sha3": "_sha3/_sha3_build.py",
147 + cffi_targets=( blake2/_blake2 sha3/_sha3 ssl
148 + audioop curses syslog pwdgrp resource lzma decimal )
149 + use gdbm && cffi_targets+=( gdbm )
150 + use sqlite && cffi_targets+=( sqlite3 )
151 + use tk && cffi_targets+=( tkinter/tklib )
152 +
153 + einfo "Please disregard the import errors during CFFI cache generation."
154 + einfo "They come from modules not built yet."
155 +
156 + local t
157 + # all modules except tkinter output to .
158 + # tkinter outputs to the correct dir ...
159 + cd lib_pypy || die
160 + for t in "${cffi_targets[@]}"; do
161 + # tkinter doesn't work via -m
162 + ../pypy3-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
163 + done
164 +
165 + # Cleanup temporary objects
166 + find -name "_cffi_*.[co]" -delete || die
167 + find -type d -empty -delete || die
168 +}
169 +
170 +src_test() {
171 + # (unset)
172 + local -x PYTHONDONTWRITEBYTECODE=
173 +
174 + # Test runner requires Python 2 too. However, it spawns PyPy3
175 + # internally so that we end up testing the correct interpreter.
176 + "${PYTHON}" ./pypy/test_all.py --pypy=./pypy3-c -vv lib-python || die
177 +}
178 +
179 +src_install() {
180 + local dest=/usr/lib/pypy3.6
181 + einfo "Installing PyPy ..."
182 + exeinto "${dest}"
183 + doexe pypy3-c libpypy3-c.so
184 + pax-mark m "${ED%/}${dest}/pypy3-c" "${ED%/}${dest}/libpypy3-c.so"
185 + insinto "${dest}"
186 + # preserve mtimes to avoid obsoleting caches
187 + insopts -p
188 + doins -r include lib_pypy lib-python
189 + dosym ../lib/pypy3.6/pypy3-c /usr/bin/pypy3
190 + dodoc README.rst
191 +
192 + if ! use gdbm; then
193 + rm -r "${ED%/}${dest}"/lib_pypy/_gdbm* || die
194 + fi
195 + if ! use sqlite; then
196 + rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
197 + "${ED%/}${dest}"/lib_pypy/_sqlite3* \
198 + "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
199 + fi
200 + if ! use tk; then
201 + rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
202 + "${ED%/}${dest}"/lib_pypy/_tkinter \
203 + "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
204 + fi
205 +
206 + einfo "Generating caches and byte-compiling ..."
207 +
208 + local -x PYTHON=${ED%/}${dest}/pypy3-c
209 + # we can't use eclass function since PyPy is dumb and always gives
210 + # paths relative to the interpreter
211 + local PYTHON_SITEDIR=${EPREFIX}/usr/lib/pypy3.6/site-packages
212 + python_export pypy3 EPYTHON
213 +
214 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
215 + python_domodule epython.py
216 +
217 + einfo "Byte-compiling Python standard library..."
218 +
219 + # compile the installed modules
220 + python_optimize "${ED%/}${dest}"
221 +}