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/files/, dev-python/pypy3/
Date: Fri, 11 Sep 2020 21:05:08
Message-Id: 1599858301.0605937f45b2f636fd675e53367279e4c54e85e1.mgorny@gentoo
1 commit: 0605937f45b2f636fd675e53367279e4c54e85e1
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 11 10:42:56 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 11 21:05:01 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0605937f
7
8 dev-python/pypy3: Add PyPy3.7 version
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy3/Manifest | 1 +
13 .../pypy3/files/7.3.2-py37-distutils-cxx.patch | 314 ++++++++++++++++++
14 dev-python/pypy3/pypy3-7.3.2_rc1-r100.ebuild | 352 +++++++++++++++++++++
15 3 files changed, 667 insertions(+)
16
17 diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
18 index 0b16f02d6f2..4d82772ad7b 100644
19 --- a/dev-python/pypy3/Manifest
20 +++ b/dev-python/pypy3/Manifest
21 @@ -1,3 +1,4 @@
22 DIST pypy3.6-v7.3.0-src.tar.bz2 21937786 BLAKE2B c53ac32a9cca1c4624160eae9f11b5705a59613f1e5100fbb0ee86118de5a7845b8fa5087165d7f5a077d20337dfca14a1c7eadbe768995e20e249ec271ac10d SHA512 313a4254262dd8d8b995a50bddbc360cfb67add0818e51a3e9ce25bda6a9b639e9fea8efe7da6adda76dff0a86a364544a13faa516e51b9ea6c25ec99223b435
23 DIST pypy3.6-v7.3.1-src.tar.bz2 22712809 BLAKE2B 4250b3fe98c611b9635319c106b80e88ab469eab5f883babb738e175e7b7adc22c85f8ef3fdce1cdc127b521beef8d6c7862e188d8c8889c39f90136d6bbe374 SHA512 f8e32aae7f01225e0e4d6763eaac40fc02dffc3d0b6a30f22d422147f9be4f3290ea78160a912ffae311dea3d503eb31a7a4f3999d3b541fbccd93d1cef4ca56
24 DIST pypy3.6-v7.3.2rc1-src.tar.bz2 22730858 BLAKE2B 41a0702d0077c0f546998b858bc8b76226fe8903f4819497aa284231edcb32bc8b047b0a2a35bacfb18ea11fb85de98b95998276c22a3f0dc716b16871b35a3a SHA512 1a6f93f7e767b0db5c40c1e06cadd781c6ddfb02ec86aa61a37f649fe1aa5cd71f7857052e5b48092e3bf8b5cbef6d6401097bf4c4e80c62f7dbdffcd20b70c0
25 +DIST pypy3.7-v7.3.2rc1-src.tar.bz2 24805791 BLAKE2B 7b16ba9f0b33d572facdf009701712fe1b2c1eb5a4187c3a9197973ef4da140c7704b3409c7c336e1027f89df340fcefc9e52c6ccac75b251aa79d67c98e49c4 SHA512 d2a5c02a541c0ae79cf8c8e1a38299351f9dd81d1a17724d9fe346d8eb4311e2566a319cf1b8a90d393bffdc11657f6fa2f6475441634e57701b00e74899baa0
26
27 diff --git a/dev-python/pypy3/files/7.3.2-py37-distutils-cxx.patch b/dev-python/pypy3/files/7.3.2-py37-distutils-cxx.patch
28 new file mode 100644
29 index 00000000000..d126edacc6b
30 --- /dev/null
31 +++ b/dev-python/pypy3/files/7.3.2-py37-distutils-cxx.patch
32 @@ -0,0 +1,314 @@
33 +diff --git a/lib-python/3/distutils/cygwinccompiler.py b/lib-python/3/distutils/cygwinccompiler.py
34 +index 6c5d777..640fa2d 100644
35 +--- a/lib-python/3/distutils/cygwinccompiler.py
36 ++++ b/lib-python/3/distutils/cygwinccompiler.py
37 +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler):
38 + # dllwrap 2.10.90 is buggy
39 + if self.ld_version >= "2.10.90":
40 + self.linker_dll = "gcc"
41 ++ self.linker_dll_cxx = "g++"
42 + else:
43 + self.linker_dll = "dllwrap"
44 ++ self.linker_dll_cxx = "dllwrap"
45 +
46 + # ld_version >= "2.13" support -shared so use it instead of
47 + # -mdll -static
48 +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler):
49 + self.set_executables(compiler='gcc -mcygwin -O -Wall',
50 + compiler_so='gcc -mcygwin -mdll -O -Wall',
51 + compiler_cxx='g++ -mcygwin -O -Wall',
52 ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
53 + linker_exe='gcc -mcygwin',
54 + linker_so=('%s -mcygwin %s' %
55 +- (self.linker_dll, shared_option)))
56 ++ (self.linker_dll, shared_option)),
57 ++ linker_exe_cxx='g++ -mcygwin',
58 ++ linker_so_cxx=('%s -mcygwin %s' %
59 ++ (self.linker_dll_cxx, shared_option)))
60 +
61 + # cygwin and mingw32 need different sets of libraries
62 + if self.gcc_version == "2.91.57":
63 +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler):
64 + raise CompileError(msg)
65 + else: # for other files use the C-compiler
66 + try:
67 +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
68 +- extra_postargs)
69 ++ if self.detect_language(src) == 'c++':
70 ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
71 ++ extra_postargs)
72 ++ else:
73 ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
74 ++ extra_postargs)
75 + except DistutilsExecError as msg:
76 + raise CompileError(msg)
77 +
78 +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler):
79 + self.set_executables(compiler='gcc -O -Wall',
80 + compiler_so='gcc -mdll -O -Wall',
81 + compiler_cxx='g++ -O -Wall',
82 ++ compiler_so_cxx='g++ -mdll -O -Wall',
83 + linker_exe='gcc',
84 + linker_so='%s %s %s'
85 + % (self.linker_dll, shared_option,
86 ++ entry_point),
87 ++ linker_exe_cxx='g++',
88 ++ linker_so_cxx='%s %s %s'
89 ++ % (self.linker_dll_cxx, shared_option,
90 + entry_point))
91 + # Maybe we should also append -mthreads, but then the finished
92 + # dlls need another dll (mingwm10.dll see Mingw32 docs)
93 +diff --git a/lib-python/3/distutils/sysconfig_cpython.py b/lib-python/3/distutils/sysconfig_cpython.py
94 +index 484721f..0088dd4 100644
95 +--- a/lib-python/3/distutils/sysconfig_cpython.py
96 ++++ b/lib-python/3/distutils/sysconfig_cpython.py
97 +@@ -188,9 +188,13 @@ def customize_compiler(compiler):
98 + _osx_support.customize_compiler(_config_vars)
99 + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
100 +
101 +- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
102 +- get_config_vars('CC', 'CXX', 'CFLAGS',
103 +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
104 ++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
105 ++ get_config_vars('CC', 'CXX',
106 ++ 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
107 ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
108 ++
109 ++ cflags = ''
110 ++ cxxflags = ''
111 +
112 + if 'CC' in os.environ:
113 + newcc = os.environ['CC']
114 +@@ -205,19 +209,27 @@ def customize_compiler(compiler):
115 + cxx = os.environ['CXX']
116 + if 'LDSHARED' in os.environ:
117 + ldshared = os.environ['LDSHARED']
118 ++ if 'LDCXXSHARED' in os.environ:
119 ++ ldcxxshared = os.environ['LDCXXSHARED']
120 + if 'CPP' in os.environ:
121 + cpp = os.environ['CPP']
122 + else:
123 + cpp = cc + " -E" # not always
124 + if 'LDFLAGS' in os.environ:
125 + ldshared = ldshared + ' ' + os.environ['LDFLAGS']
126 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
127 + if 'CFLAGS' in os.environ:
128 +- cflags = cflags + ' ' + os.environ['CFLAGS']
129 ++ cflags = os.environ['CFLAGS']
130 + ldshared = ldshared + ' ' + os.environ['CFLAGS']
131 ++ if 'CXXFLAGS' in os.environ:
132 ++ cxxflags = os.environ['CXXFLAGS']
133 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
134 + if 'CPPFLAGS' in os.environ:
135 + cpp = cpp + ' ' + os.environ['CPPFLAGS']
136 + cflags = cflags + ' ' + os.environ['CPPFLAGS']
137 ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
138 + ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
139 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
140 + if 'AR' in os.environ:
141 + ar = os.environ['AR']
142 + if 'ARFLAGS' in os.environ:
143 +@@ -226,13 +238,17 @@ def customize_compiler(compiler):
144 + archiver = ar + ' ' + ar_flags
145 +
146 + cc_cmd = cc + ' ' + cflags
147 ++ cxx_cmd = cxx + ' ' + cxxflags
148 + compiler.set_executables(
149 + preprocessor=cpp,
150 + compiler=cc_cmd,
151 + compiler_so=cc_cmd + ' ' + ccshared,
152 +- compiler_cxx=cxx,
153 ++ compiler_cxx=cxx_cmd,
154 ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
155 + linker_so=ldshared,
156 + linker_exe=cc,
157 ++ linker_so_cxx=ldcxxshared,
158 ++ linker_exe_cxx=cxx,
159 + archiver=archiver)
160 +
161 + compiler.shared_lib_extension = shlib_suffix
162 +diff --git a/lib-python/3/distutils/sysconfig_pypy.py b/lib-python/3/distutils/sysconfig_pypy.py
163 +index bf1748e..70dfd72 100644
164 +--- a/lib-python/3/distutils/sysconfig_pypy.py
165 ++++ b/lib-python/3/distutils/sysconfig_pypy.py
166 +@@ -145,36 +145,52 @@ def customize_compiler(compiler):
167 + _osx_support.customize_compiler(_config_vars)
168 + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
169 +
170 +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
171 +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
172 +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
173 ++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
174 ++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
175 ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
176 ++
177 ++ cflags = ''
178 ++ cxxflags = ''
179 +
180 + if 'CC' in os.environ:
181 + newcc = os.environ['CC']
182 +- if (sys.platform == 'darwin'
183 ++ if (True
184 + and 'LDSHARED' not in os.environ
185 + and ldshared.startswith(cc)):
186 + # On OS X, if CC is overridden, use that as the default
187 + # command for LDSHARED as well
188 ++ # Gentoo: s/OS X/every system/
189 + ldshared = newcc + ldshared[len(cc):]
190 + cc = newcc
191 + if 'CXX' in os.environ:
192 +- cxx = os.environ['CXX']
193 ++ newcxx = os.environ['CXX']
194 ++ if ('LDCXXSHARED' not in os.environ
195 ++ and ldcxxshared.startswith(cxx)):
196 ++ ldcxxshared = newcxx + ldcxxshared[len(cxx):]
197 ++ cxx = newcxx
198 + if 'LDSHARED' in os.environ:
199 + ldshared = os.environ['LDSHARED']
200 ++ if 'LDCXXSHARED' in os.environ:
201 ++ ldcxxshared = os.environ['LDCXXSHARED']
202 + if 'CPP' in os.environ:
203 + cpp = os.environ['CPP']
204 + else:
205 + cpp = cc + " -E" # not always
206 + if 'LDFLAGS' in os.environ:
207 + ldshared = ldshared + ' ' + os.environ['LDFLAGS']
208 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
209 + if 'CFLAGS' in os.environ:
210 +- cflags = opt + ' ' + os.environ['CFLAGS']
211 ++ cflags = os.environ['CFLAGS']
212 + ldshared = ldshared + ' ' + os.environ['CFLAGS']
213 ++ if 'CXXFLAGS' in os.environ:
214 ++ cxxflags = os.environ['CXXFLAGS']
215 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
216 + if 'CPPFLAGS' in os.environ:
217 + cpp = cpp + ' ' + os.environ['CPPFLAGS']
218 + cflags = cflags + ' ' + os.environ['CPPFLAGS']
219 ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
220 + ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
221 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
222 + if 'AR' in os.environ:
223 + ar = os.environ['AR']
224 + if 'ARFLAGS' in os.environ:
225 +@@ -183,13 +199,17 @@ def customize_compiler(compiler):
226 + archiver = ar + ' ' + ar_flags
227 +
228 + cc_cmd = cc + ' ' + cflags
229 ++ cxx_cmd = cxx + ' ' + cxxflags
230 + compiler.set_executables(
231 + preprocessor=cpp,
232 + compiler=cc_cmd,
233 + compiler_so=cc_cmd + ' ' + ccshared,
234 +- compiler_cxx=cxx,
235 ++ compiler_cxx=cxx_cmd,
236 ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
237 + linker_so=ldshared,
238 + linker_exe=cc,
239 ++ linker_so_cxx=ldcxxshared,
240 ++ linker_exe_cxx=cxx,
241 + archiver=archiver)
242 +
243 + compiler.shared_lib_extension = shlib_suffix
244 +diff --git a/lib-python/3/distutils/unixccompiler.py b/lib-python/3/distutils/unixccompiler.py
245 +index 06fc718..c3773f0 100644
246 +--- a/lib-python/3/distutils/unixccompiler.py
247 ++++ b/lib-python/3/distutils/unixccompiler.py
248 +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
249 + # are pretty generic; they will probably have to be set by an outsider
250 + # (eg. using information discovered by the sysconfig about building
251 + # Python extensions).
252 +- executables = {'preprocessor' : None,
253 +- 'compiler' : ["cc"],
254 +- 'compiler_so' : ["cc"],
255 +- 'compiler_cxx' : ["c++"], # pypy: changed, 'cc' is bogus
256 +- 'linker_so' : ["cc", "-shared"],
257 +- 'linker_exe' : ["cc"],
258 +- 'archiver' : ["ar", "-cr"],
259 +- 'ranlib' : None,
260 ++ executables = {'preprocessor' : None,
261 ++ 'compiler' : ["cc"],
262 ++ 'compiler_so' : ["cc"],
263 ++ 'compiler_cxx' : ["c++"],
264 ++ 'compiler_so_cxx' : ["c++"],
265 ++ 'linker_so' : ["cc", "-shared"],
266 ++ 'linker_exe' : ["cc"],
267 ++ 'linker_so_cxx' : ["c++", "-shared"],
268 ++ 'linker_exe_cxx' : ["c++"],
269 ++ 'archiver' : ["ar", "-cr"],
270 ++ 'ranlib' : None,
271 + }
272 +
273 + if sys.platform[:6] == "darwin":
274 +@@ -125,12 +128,19 @@ class UnixCCompiler(CCompiler):
275 +
276 + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
277 + compiler_so = self.compiler_so
278 ++ compiler_so_cxx = self.compiler_so_cxx
279 + if sys.platform == 'darwin':
280 + compiler_so = _osx_support.compiler_fixup(compiler_so,
281 + cc_args + extra_postargs)
282 ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
283 ++ cc_args + extra_postargs)
284 + try:
285 +- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
286 +- extra_postargs)
287 ++ if self.detect_language(src) == 'c++':
288 ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
289 ++ extra_postargs)
290 ++ else:
291 ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
292 ++ extra_postargs)
293 + except DistutilsExecError as msg:
294 + raise CompileError(msg)
295 +
296 +@@ -188,30 +198,16 @@ class UnixCCompiler(CCompiler):
297 + ld_args.extend(extra_postargs)
298 + self.mkpath(os.path.dirname(output_filename))
299 + try:
300 +- if target_desc == CCompiler.EXECUTABLE:
301 +- linker = self.linker_exe[:]
302 ++ if target_lang == "c++":
303 ++ if target_desc == CCompiler.EXECUTABLE:
304 ++ linker = self.linker_exe_cxx[:]
305 ++ else:
306 ++ linker = self.linker_so_cxx[:]
307 + else:
308 +- linker = self.linker_so[:]
309 +- if target_lang == "c++" and self.compiler_cxx:
310 +- # skip over environment variable settings if /usr/bin/env
311 +- # is used to set up the linker's environment.
312 +- # This is needed on OSX. Note: this assumes that the
313 +- # normal and C++ compiler have the same environment
314 +- # settings.
315 +- i = 0
316 +- if os.path.basename(linker[0]) == "env":
317 +- i = 1
318 +- while '=' in linker[i]:
319 +- i += 1
320 +-
321 +- if os.path.basename(linker[i]) == 'ld_so_aix':
322 +- # AIX platforms prefix the compiler with the ld_so_aix
323 +- # script, so we need to adjust our linker index
324 +- offset = 1
325 ++ if target_desc == CCompiler.EXECUTABLE:
326 ++ linker = self.linker_exe[:]
327 + else:
328 +- offset = 0
329 +-
330 +- linker[i+offset] = self.compiler_cxx[i]
331 ++ linker = self.linker_so[:]
332 +
333 + if sys.platform == 'darwin':
334 + linker = _osx_support.compiler_fixup(linker, ld_args)
335 +diff --git a/lib_pypy/_sysconfigdata.py b/lib_pypy/_sysconfigdata.py
336 +index f1cca41..3ec5b4c 100644
337 +--- a/lib_pypy/_sysconfigdata.py
338 ++++ b/lib_pypy/_sysconfigdata.py
339 +@@ -20,6 +20,7 @@ build_time_vars = {
340 + 'CFLAGS': "-DNDEBUG -O2",
341 + 'CCSHARED': "-fPIC",
342 + 'LDSHARED': "cc -pthread -shared",
343 ++ 'LDCXXSHARED': "c++ -pthread -shared",
344 + 'EXT_SUFFIX': so_ext,
345 + 'SHLIB_SUFFIX': ".so",
346 + 'AR': "ar",
347
348 diff --git a/dev-python/pypy3/pypy3-7.3.2_rc1-r100.ebuild b/dev-python/pypy3/pypy3-7.3.2_rc1-r100.ebuild
349 new file mode 100644
350 index 00000000000..2ba33e2c40c
351 --- /dev/null
352 +++ b/dev-python/pypy3/pypy3-7.3.2_rc1-r100.ebuild
353 @@ -0,0 +1,352 @@
354 +# Copyright 1999-2020 Gentoo Authors
355 +# Distributed under the terms of the GNU General Public License v2
356 +
357 +EAPI=7
358 +
359 +PYTHON_COMPAT=( python2_7 )
360 +inherit pax-utils python-any-r1 toolchain-funcs
361 +
362 +MY_P=pypy3.7-v${PV/_/}
363 +
364 +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.7) language"
365 +HOMEPAGE="https://pypy.org/"
366 +SRC_URI="https://downloads.python.org/pypy/${MY_P}-src.tar.bz2"
367 +S="${WORKDIR}/${MY_P}-src"
368 +
369 +LICENSE="MIT"
370 +# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
371 +SLOT="0/pypy37-pp73"
372 +KEYWORDS="~amd64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
373 +IUSE="bzip2 gdbm +jit libressl ncurses sqlite test tk"
374 +RESTRICT="!test? ( test )"
375 +
376 +RDEPEND="
377 + || (
378 + dev-python/pypy3-exe:${PV}-py37[bzip2?,ncurses?]
379 + dev-python/pypy3-exe-bin:${PV}-py37
380 + )
381 + !libressl? ( dev-libs/openssl:0= )
382 + libressl? ( dev-libs/libressl:0= )
383 + gdbm? ( sys-libs/gdbm:0= )
384 + sqlite? ( dev-db/sqlite:3= )
385 + tk? (
386 + dev-lang/tk:0=
387 + dev-tcltk/tix:0=
388 + )
389 + !<dev-python/pypy3-bin-7.3.0:0"
390 +DEPEND="${RDEPEND}
391 + test? (
392 + ${PYTHON_DEPS}
393 + !!dev-python/pytest-forked
394 + )"
395 +
396 +pkg_setup() {
397 + use test && python-any-r1_pkg_setup
398 +}
399 +
400 +src_prepare() {
401 + eapply "${FILESDIR}/7.3.1-gentoo-path.patch"
402 + eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
403 + eapply "${FILESDIR}/7.3.2-py37-distutils-cxx.patch"
404 +
405 + sed -e "s^@EPREFIX@^${EPREFIX}^" \
406 + -i lib-python/3/distutils/command/install.py || die
407 +
408 + # apply CPython stdlib patches
409 + pushd lib-python/3 > /dev/null || die
410 + eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
411 + popd > /dev/null || die
412 +
413 + # see http://buildbot.pypy.org/summary?branch=py3.7&builder=pypy-c-jit-linux-x86-64
414 + sed -i -e 's:test_snippets(:_&:' \
415 + lib-python/3/test/test_ast.py || die
416 + sed -i -e 's:testConstructorErrorMessages(:_&:' \
417 + lib-python/3/test/test_class.py || die
418 + sed -i -e 's:test_pythonmalloc(:_&:' \
419 + -e 's:test_sys_flags_set(:_&:' \
420 + -e 's:test_unbuffered_output(:_&:' \
421 + -e 's:test_xdev(:_&:' \
422 + -e 's:test_ignore_PYTHONHASHSEED(:_&:' \
423 + lib-python/3/test/test_cmd_line.py || die
424 + sed -i -e 's:test_consistent_sys_path_for_module_execution(:_&:' \
425 + -e 's:test_issue8202(:_&:' \
426 + -e 's:test_issue8202_dash_m_file_ignored(:_&:' \
427 + -e 's:test_module_in_package(:_&:' \
428 + -e 's:test_module_in_package_in_zipfile(:_&:' \
429 + -e 's:test_module_in_subpackage_in_zipfile(:_&:' \
430 + -e 's:test_nonexisting_script(:_&:' \
431 + -e 's:test_package(:_&:' \
432 + -e 's:test_package_compiled(:_&:' \
433 + -e 's:test_script_compiled(:_&:' \
434 + lib-python/3/test/test_cmd_line_script.py || die
435 + sed -i -e 's:test_incremental_errors(:_&:' \
436 + lib-python/3/test/test_codecs.py || die
437 + sed -i -e 's:test_ressources_gced_in_workers(:_&:' \
438 + -e 's:test_submit_after_interpreter_shutdown(:_&:' \
439 + lib-python/3/test/test_concurrent_futures.py || die
440 + sed -i -e 's:test_for_3(:_&:' \
441 + -e 's:test_func_4(:_&:' \
442 + lib-python/3/test/test_coroutines.py || die
443 + sed -i -e 's:test_strftime(:_&:' \
444 + -e 's:test_more_strftime(:_&:' \
445 + lib-python/3/test/datetimetester.py || die
446 + sed -i -e 's:test_info(:_&:' \
447 + -e 's:test_code_info(:_&:' \
448 + -e 's:test_show_code(:_&:' \
449 + -e 's:test_disassemble_recursive(:_&:' \
450 + -e 's:test_disassemble_str(:_&:' \
451 + -e 's:test_jumpy(:_&:' \
452 + lib-python/3/test/test_dis.py || die
453 + sed -i -e 's:test_generator_doesnt_retain_old_exc2(:_&:' \
454 + -e 's:test_attributes(:_&:' \
455 + lib-python/3/test/test_exceptions.py || die
456 + sed -i -e 's:test_frozen(:_&:' \
457 + lib-python/3/test/test_frozen.py || die
458 + sed -i -e 's:test_ssl_raises(:_&:' \
459 + -e 's:test_ssl_verified(:_&:' \
460 + lib-python/3/test/test_imaplib.py || die
461 + sed -i -e 's:test_script_compiled(:_&:' \
462 + lib-python/3/test/test_multiprocessing_main_handling.py || die
463 + sed -i -e 's:test_execve_invalid_env(:_&:' \
464 + lib-python/3/test/test_os.py || die
465 + sed -i -e 's:test_get_and_set_scheduler_and_param(:_&:' \
466 + lib-python/3/test/test_posix.py || die
467 + sed -i -e 's:test_copying(:_&:' \
468 + -e 's:test_re_split(:_&:' \
469 + -e 's:test_zerowidth(:_&:' \
470 + -e 's:test_locale_caching(:_&:' \
471 + -e 's:test_locale_compiled(:_&:' \
472 + -e 's:test_match_repr(:_&:' \
473 + -e 's:test_qualified_re_split(:_&:' \
474 + -e 's:test_scoped_flags(:_&:' \
475 + lib-python/3/test/test_re.py || die
476 + sed -i -e 's:test_auto_history_disabled(:_&:' \
477 + -e 's:test_auto_history_enabled(:_&:' \
478 + -e 's:test_history_size(:_&:' \
479 + lib-python/3/test/test_readline.py || die
480 + sed -i -e 's:test_multiprocess(:_&:' \
481 + lib-python/3/test/test_regrtest.py || die
482 + sed -i -e 's:test_warn_on_full_buffer(:_&:' \
483 + lib-python/3/test/test_signal.py || die
484 + sed -i -e 's:test_get_path(:_&:' \
485 + lib-python/3/test/test_site.py || die
486 + sed -i -e 's:test_check_hostname(:_&:' \
487 + -e 's:test_npn_protocols(:_&:' \
488 + -e 's:test_sni_callback(:_&:' \
489 + -e 's:test_sni_callback_raising(:_&:' \
490 + lib-python/3/test/test_ssl.py || die
491 + sed -i -e 's:test_invalid_placeholders(:_&:' \
492 + lib-python/3/test/test_string.py || die
493 + sed -i -e 's:test_eval_bytes_invalid_escape(:_&:' \
494 + -e 's:test_eval_str_invalid_escape(:_&:' \
495 + lib-python/3/test/test_string_literals.py || die
496 + sed -i -e 's:test_boundary_error_message_with_large_offset(:_&:' \
497 + lib-python/3/test/test_struct.py || die
498 + sed -i -e 's:test_restore_signals(:_&:' \
499 + lib-python/3/test/test_subprocess.py || die
500 + sed -i -e 's:test_jump_out_of_async_for_block_backwards(:_&:' \
501 + -e 's:test_jump_out_of_async_for_block_forwards(:_&:' \
502 + -e 's:test_jump_over_async_for_block_before_else(:_&:' \
503 + -e 's:test_no_jump_backwards_into_async_for_block(:_&:' \
504 + -e 's:test_no_jump_forwards_into_async_for_block(:_&:' \
505 + -e 's:test_no_jump_into_async_for_block_before_else(:_&:' \
506 + -e 's:test_no_jump_from_yield(:_&:' \
507 + lib-python/3/test/test_sys_settrace.py || die
508 + sed -i -e 's:test_install_schemes(:_&:' \
509 + lib-python/3/test/test_sysconfig_pypy.py || die
510 + sed -i -e 's:test_circular_imports(:_&:' \
511 + lib-python/3/test/test_threaded_import.py || die
512 + sed -i -e 's:test_main_milliseconds(:_&:' \
513 + -e 's:test_main_verbose(:_&:' \
514 + -e 's:test_main_very_verbose(:_&:' \
515 + -e 's:test_main_with_time_unit(:_&:' \
516 + lib-python/3/test/test_timeit.py || die
517 + sed -i -e 's:test_cannot_subclass(:_&:' \
518 + lib-python/3/test/test_typing.py || die
519 + sed -i -e 's:test_warnings(:_&:' \
520 + lib-python/3/unittest/test/test_runner.py || die
521 + sed -i -e 's:test_cmd_line(:_&:' \
522 + -e 's:test_env_var(:_&:' \
523 + -e 's:test_locale_getpreferredencoding(:_&:' \
524 + -e 's:test_posix_locale(:_&:' \
525 + -e 's:test_stdio(:_&:' \
526 + -e 's:test_xoption(:_&:' \
527 + lib-python/3/test/test_utf8_mode.py || die
528 + sed -i -e 's:test_asyncgen_finalization_by_gc(:_&:' \
529 + -e 's:test_asyncgen_finalization_by_gc_in_other_thread(:_&:' \
530 + -e 's:test_create_connection_ipv6_scope(:_&:' \
531 + lib-python/3/test/test_asyncio/test_base_events.py || die
532 + sed -i -e 's:test_buffered_proto_create_connection(:_&:' \
533 + lib-python/3/test/test_asyncio/test_buffered_proto.py || die
534 + sed -i -e 's:test_create_connection_memory_leak(:_&:' \
535 + -e 's:test_handshake_timeout(:_&:' \
536 + -e 's:test_start_tls_client_reg_proto_1(:_&:' \
537 + lib-python/3/test/test_asyncio/test_sslproto.py || die
538 + sed -i -e 's:test_bare_create_task(:_&:' \
539 + -e 's:test_current_task(:_&:' \
540 + lib-python/3/test/test_asyncio/test_tasks.py || die
541 + sed -i -e 's:test_asyncio_task_decimal_context(:_&:' \
542 + lib-python/3/test/test_asyncio/test_context.py || die
543 + sed -i -e 's:test_create_server_ssl_match_failed(:_&:' \
544 + lib-python/3/test/test_asyncio/test_events.py || die
545 + sed -i -e 's:test_binding(:_&:' \
546 + -e 's:test_from_import_AttributeError(:_&:' \
547 + -e 's:test_from_import_missing_attr_has_name_and_path(:_&:' \
548 + -e 's:test_from_import_missing_attr_path_is_canonical(:_&:' \
549 + lib-python/3/test/test_import/__init__.py || die
550 + sed -i -e 's:test_unrelated_contents(:_&:' \
551 + -e 's:test_contents(:_&:' \
552 + -e 's:test_submodule_contents(:_&:' \
553 + -e 's:test_submodule_contents_by_name(:_&:' \
554 + -e 's:test_is_resource_good_path(:_&:' \
555 + -e 's:test_is_submodule_resource(:_&:' \
556 + -e 's:test_read_submodule_resource_by_name(:_&:' \
557 + lib-python/3/test/test_importlib/test_resource.py || die
558 + sed -i -e 's:test_non_string_keys_dict(:_&:' \
559 + lib-python/3/test/test_json/test_fail.py || die
560 + sed -i -e 's:test_module(:_&:' \
561 + lib-python/3/test/test_warnings/__init__.py || die
562 +
563 + # flaky
564 + sed -i -e 's:test_2_join_in_forked_process(:_&:' \
565 + lib-python/3/test/test_threading.py || die
566 +
567 + # TODO
568 + sed -i -e 's:test_external_target_locale_configuration(:_&:' \
569 + lib-python/3/test/test_c_locale_coercion.py || die
570 + sed -i -e 's:test_locale(:_&:' \
571 + lib-python/3/test/test_format.py || die
572 + sed -i -e 's:test_decompressor_bug_28275(:_&:' \
573 + lib-python/3/test/test_lzma.py || die
574 + sed -i -e 's:test_wrapped_exception:_&:' \
575 + lib-python/3/test/_test_multiprocessing.py || die
576 + sed -i -e 's:test_https_sni(:_&:' \
577 + lib-python/3/test/test_urllib2_localnet.py || die
578 +
579 + # the first one's broken by sandbox, the second by our env
580 + sed -i -e 's:test_executable(:_&:' \
581 + -e 's:test_executable_without_cwd(:_&:' \
582 + lib-python/3/test/test_subprocess.py || die
583 +
584 + eapply_user
585 +}
586 +
587 +src_configure() {
588 + tc-export CC
589 +}
590 +
591 +src_compile() {
592 + # copy over to make sys.prefix happy
593 + cp -p "${BROOT}"/usr/lib/pypy3.7/pypy3-c-${PV} pypy3-c || die
594 + cp -p "${BROOT}"/usr/lib/pypy3.7/include/${PV}/* include/ || die
595 + # (not installed by pypy)
596 + rm pypy/module/cpyext/include/_numpypy/numpy/README || die
597 + mv pypy/module/cpyext/include/* include/ || die
598 + mv pypy/module/cpyext/parse/*.h include/ || die
599 + pax-mark m pypy3-c
600 +
601 + einfo "Generating caches and CFFI modules ..."
602 +
603 + # Generate Grammar and PatternGrammar pickles.
604 + ./pypy3-c -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
605 + || die "Generation of Grammar and PatternGrammar pickles failed"
606 +
607 + # Generate cffi modules
608 + # Please keep in sync with pypy/tool/build_cffi_imports.py!
609 +#cffi_build_scripts = {
610 +# "_blake2": "_blake2/_blake2_build.py",
611 +# "_ssl": "_ssl_build.py",
612 +# "sqlite3": "_sqlite3_build.py",
613 +# "audioop": "_audioop_build.py",
614 +# "tk": "_tkinter/tklib_build.py",
615 +# "curses": "_curses_build.py" if sys.platform != "win32" else None,
616 +# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
617 +# "gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
618 +# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
619 +# "resource": "_resource_build.py" if sys.platform != "win32" else None,
620 +# "lzma": "_lzma_build.py",
621 +# "_decimal": "_decimal_build.py",
622 +# "_sha3": "_sha3/_sha3_build.py",
623 + cffi_targets=( blake2/_blake2 sha3/_sha3 ssl
624 + audioop syslog pwdgrp resource lzma decimal )
625 + use gdbm && cffi_targets+=( gdbm )
626 + use ncurses && cffi_targets+=( curses )
627 + use sqlite && cffi_targets+=( sqlite3 )
628 + use tk && cffi_targets+=( tkinter/tklib )
629 +
630 + local t
631 + # all modules except tkinter output to .
632 + # tkinter outputs to the correct dir ...
633 + cd lib_pypy || die
634 + for t in "${cffi_targets[@]}"; do
635 + # tkinter doesn't work via -m
636 + ../pypy3-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
637 + done
638 +
639 + # Cleanup temporary objects
640 + find -name "_cffi_*.[co]" -delete || die
641 + find -type d -empty -delete || die
642 +}
643 +
644 +src_test() {
645 + # (unset)
646 + local -x PYTHONDONTWRITEBYTECODE=
647 + local -x COLUMNS=80
648 +
649 + local ignore=(
650 + # failing doctests
651 + lib-python/3/test/test_extcall.py
652 + lib-python/3/test/test_unpack_ex.py
653 +
654 + # segfault
655 + lib-python/3/test/test_capi.py
656 + )
657 +
658 + # Test runner requires Python 2 too. However, it spawns PyPy3
659 + # internally so that we end up testing the correct interpreter.
660 + # (--deselect for failing doctests)
661 + "${EPYTHON}" ./pypy/test_all.py --pypy=./pypy3-c -vv lib-python \
662 + ${ignore[@]/#/--ignore } || die
663 +}
664 +
665 +src_install() {
666 + local dest=/usr/lib/pypy3.7
667 + einfo "Installing PyPy ..."
668 + dosym pypy3-c-${PV} "${dest}/pypy3-c"
669 + insinto "${dest}"
670 + # preserve mtimes to avoid obsoleting caches
671 + insopts -p
672 + doins -r include lib_pypy lib-python
673 +
674 + # replace copied headers with symlinks
675 + for x in "${BROOT}"/usr/lib/pypy3.7/include/${PV}/*; do
676 + dosym "${PV}/${x##*/}" "${dest}/include/${x##*/}"
677 + done
678 +
679 + dosym ../lib/pypy3.7/pypy3-c /usr/bin/pypy3
680 + dodoc README.rst
681 +
682 + if ! use gdbm; then
683 + rm -r "${ED}${dest}"/lib_pypy/_gdbm* || die
684 + fi
685 + if ! use sqlite; then
686 + rm -r "${ED}${dest}"/lib-python/*3/sqlite3 \
687 + "${ED}${dest}"/lib_pypy/_sqlite3* \
688 + "${ED}${dest}"/lib-python/*3/test/test_sqlite.py || die
689 + fi
690 + if ! use tk; then
691 + rm -r "${ED}${dest}"/lib-python/*3/{idlelib,tkinter} \
692 + "${ED}${dest}"/lib_pypy/_tkinter \
693 + "${ED}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
694 + fi
695 +
696 + local -x EPYTHON=pypy3
697 + local -x PYTHON=${ED}${dest}/pypy3-c
698 +
699 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
700 + python_moduleinto /usr/lib/pypy3.7/site-packages
701 + python_domodule epython.py
702 +
703 + einfo "Byte-compiling Python standard library..."
704 + python_optimize "${ED}${dest}"
705 +}