diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-07-27 11:19:19 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-07-27 11:19:19 +0000 |
commit | 34da28d5ff1c905902068381f2f9bf9298f54e29 (patch) | |
tree | 98c7f31a92f39c6528b3941b37f847825117ab3b /dev-python | |
parent | Switch eclasses to use virtual/pypy (and therefore support pypy-bin). (diff) | |
download | gentoo-2-34da28d5ff1c905902068381f2f9bf9298f54e29.tar.gz gentoo-2-34da28d5ff1c905902068381f2f9bf9298f54e29.tar.bz2 gentoo-2-34da28d5ff1c905902068381f2f9bf9298f54e29.zip |
Initial versions of pypy binary packages.
(Portage version: 2.2.0_alpha190/cvs/Linux x86_64, signed Manifest commit with key 9627F456F9DA7643!)
Diffstat (limited to 'dev-python')
19 files changed, 1713 insertions, 0 deletions
diff --git a/dev-python/pypy-bin/ChangeLog b/dev-python/pypy-bin/ChangeLog new file mode 100644 index 000000000000..d99aafadc26f --- /dev/null +++ b/dev-python/pypy-bin/ChangeLog @@ -0,0 +1,23 @@ +# ChangeLog for dev-python/pypy-bin +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy-bin/ChangeLog,v 1.3 2013/07/27 11:19:19 mgorny Exp $ + +*pypy-bin-1.9 (27 Jul 2013) +*pypy-bin-2.0.2 (27 Jul 2013) + + 27 Jul 2013; Michał Górny <mgorny@gentoo.org> + +files/1.9-distutils-fix_handling_of_executables_and_flags.patch, +files/1.9-d + istutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch, + +files/1.9-get_python_lib_standard_lib-04ea518e5b71.patch, + +files/1.9-getargs-freelist-c26dc70ee340.patch, + +files/1.9-more-ignored-ops-146ddf82a279.patch, + +files/1.9-more-ignored-ops-a9a8faa76bca.patch, + +files/1.9-no-bytecode-4151f9c406b6.patch, +files/1.9-no-static-hack.patch, + +files/1.9-pybuffer-release-double-decref-4ec2a5b49386.patch, + +files/1.9-scripts-location.patch, +files/1.9-signal-a33052b17f4e.patch, + +files/1.9-ssl-errors-25d3418150d2.patch, + +files/1.9-ssl-threads-1-34b3b5aac082.patch, + +files/1.9-ssl-threads-2-25cd11066d95.patch, + +files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch, + +metadata.xml, +pypy-bin-1.9.ebuild, +pypy-bin-2.0.2.ebuild: + Initial versions of pypy binary packages. diff --git a/dev-python/pypy-bin/files/1.9-distutils-fix_handling_of_executables_and_flags.patch b/dev-python/pypy-bin/files/1.9-distutils-fix_handling_of_executables_and_flags.patch new file mode 100644 index 000000000000..4a35ea8cb3c7 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-distutils-fix_handling_of_executables_and_flags.patch @@ -0,0 +1,391 @@ +--- lib-python/2.7/distutils/ccompiler.py ++++ lib-python/2.7/distutils/ccompiler.py +@@ -27,10 +27,16 @@ + varies across Unices and is stored in Python's Makefile. + """ + if compiler.compiler_type == "unix": +- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ +- _sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SO', 'AR', +- 'ARFLAGS') ++ cc = ' '.join(compiler.compiler) ++ cxx = ' '.join(compiler.compiler_cxx) ++ ldshared = ' '.join(compiler.linker_so) ++ ldcxxshared = ' '.join(compiler.linker_so_cxx) ++ ar = compiler.archiver[0] ++ ++ cflags = '' ++ cxxflags = '' ++ ccshared = '-fPIC' ++ ar_flags = compiler.archiver[1] + + if 'CC' in os.environ: + cc = os.environ['CC'] +@@ -38,19 +44,27 @@ + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = opt + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -59,17 +73,19 @@ + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + +- compiler.shared_lib_extension = so_ext +- + class CCompiler: + """Abstract base class to define the interface that must be implemented + by real compiler classes. Also has some utility methods used by +--- lib-python/2.7/distutils/cygwinccompiler.py ++++ lib-python/2.7/distutils/cygwinccompiler.py +@@ -135,9 +135,13 @@ + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -163,8 +167,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -325,10 +333,15 @@ + self.set_executables(compiler='gcc -mno-cygwin -O -Wall', + compiler_so='gcc -mno-cygwin -mdll -O -Wall', + compiler_cxx='g++ -mno-cygwin -O -Wall', ++ compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall', + linker_exe='gcc -mno-cygwin', + linker_so='%s -mno-cygwin %s %s' + % (self.linker_dll, shared_option, +- entry_point)) ++ entry_point), ++ linker_exe_cxx='g++ -mno-cygwin', ++ linker_so_cxx='%s -mno-cygwin %s %s' ++ % (self.linker_dll, shared_option, ++ entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) + # (-mthreads: Support thread-safe exception handling on `Mingw32') +--- lib-python/2.7/distutils/emxccompiler.py ++++ lib-python/2.7/distutils/emxccompiler.py +@@ -65,8 +65,12 @@ + # XXX optimization, warnings etc. should be customizable. + self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + linker_exe='gcc -Zomf -Zmt -Zcrtdll', +- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') ++ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll', ++ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll', ++ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll') + + # want the gcc library statically linked (so that we don't have + # to distribute a version dependent on the compiler we have) +@@ -83,8 +87,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +--- lib-python/2.7/distutils/sysconfig_cpython.py ++++ lib-python/2.7/distutils/sysconfig_cpython.py +@@ -149,9 +149,12 @@ + varies across Unices and is stored in Python's Makefile. + """ + if compiler.compiler_type == "unix": +- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SO') ++ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext) = \ ++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', ++ 'LDCXXSHARED', 'SO') ++ ++ cflags = '' ++ cxxflags = '' + + if 'CC' in os.environ: + cc = os.environ['CC'] +@@ -159,28 +162,40 @@ + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = opt + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, +- linker_exe=cc) ++ linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx) + + compiler.shared_lib_extension = so_ext + +@@ -506,7 +521,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = re.sub('-isysroot [^ \t]*', ' ', flags) +@@ -525,7 +540,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) +@@ -549,7 +564,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags) +--- lib-python/2.7/distutils/sysconfig_pypy.py ++++ lib-python/2.7/distutils/sysconfig_pypy.py +@@ -114,13 +114,56 @@ + optional C speedup components. + """ + if compiler.compiler_type == "unix": +- compiler.compiler_so.extend(['-fPIC', '-Wimplicit']) ++ cc = ' '.join(compiler.compiler) ++ cxx = ' '.join(compiler.compiler_cxx) ++ ldshared = ' '.join(compiler.linker_so) ++ ldcxxshared = ' '.join(compiler.linker_so_cxx) ++ ++ cflags = '' ++ cxxflags = '' ++ ccshared = '-fPIC' ++ ++ if 'CC' in os.environ: ++ cc = os.environ['CC'] ++ if 'CXX' in os.environ: ++ cxx = os.environ['CXX'] ++ if 'LDSHARED' in os.environ: ++ ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] ++ if 'CPP' in os.environ: ++ cpp = os.environ['CPP'] ++ else: ++ cpp = cc + " -E" # not always ++ if 'LDFLAGS' in os.environ: ++ ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] ++ if 'CFLAGS' in os.environ: ++ cflags = os.environ['CFLAGS'] ++ ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] ++ if 'CPPFLAGS' in os.environ: ++ cpp = cpp + ' ' + os.environ['CPPFLAGS'] ++ cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] ++ ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] ++ ++ cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags ++ compiler.set_executables( ++ preprocessor=cpp, ++ compiler=cc_cmd, ++ compiler_so=cc_cmd + ' ' + ccshared, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, ++ linker_so=ldshared, ++ linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx) + compiler.shared_lib_extension = get_config_var('SO') +- if "CFLAGS" in os.environ: +- cflags = os.environ["CFLAGS"] +- compiler.compiler.append(cflags) +- compiler.compiler_so.append(cflags) +- compiler.linker_so.append(cflags) + + + from sysconfig_cpython import ( +--- lib-python/2.7/distutils/unixccompiler.py ++++ lib-python/2.7/distutils/unixccompiler.py +@@ -114,14 +114,17 @@ + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -186,11 +189,18 @@ + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) ++ compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args + ++ extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -247,23 +257,16 @@ + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i = i + 1 +- +- linker[i] = self.compiler_cxx[i] ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] ++ else: ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _darwin_compiler_fixup(linker, ld_args) diff --git a/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch b/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch new file mode 100644 index 000000000000..b3d5235000d5 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch @@ -0,0 +1,11 @@ +--- lib-python/2.7/distutils/unixccompiler.py ++++ lib-python/2.7/distutils/unixccompiler.py +@@ -297,7 +297,7 @@ + # this time, there's no way to determine this information from + # the configuration data stored in the Python installation, so + # we use this hack. +- compiler = os.path.basename(sysconfig.get_config_var("CC")) ++ compiler = os.path.basename(self.compiler[0]) + if sys.platform[:6] == "darwin": + # MacOSX's linker doesn't understand the -R flag at all + return "-L" + dir diff --git a/dev-python/pypy-bin/files/1.9-get_python_lib_standard_lib-04ea518e5b71.patch b/dev-python/pypy-bin/files/1.9-get_python_lib_standard_lib-04ea518e5b71.patch new file mode 100644 index 000000000000..e6c98a50b34e --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-get_python_lib_standard_lib-04ea518e5b71.patch @@ -0,0 +1,24 @@ +changeset: 55566:04ea518e5b71 +parent: 55554:fa1ecb3a52df +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 10:28:26 2012 +0200 +summary: issue1164: get_python_lib(standard_lib=1) should probably just + +diff -r fa1ecb3a52df -r 04ea518e5b71 lib-python/2.7/distutils/sysconfig_pypy.py +--- a/lib-python/2.7/distutils/sysconfig_pypy.py Sun Jun 10 23:49:16 2012 +0300 ++++ b/lib-python/2.7/distutils/sysconfig_pypy.py Mon Jun 11 10:28:26 2012 +0200 +@@ -39,11 +39,10 @@ + If 'prefix' is supplied, use it instead of sys.prefix or + sys.exec_prefix -- i.e., ignore 'plat_specific'. + """ +- if standard_lib: +- raise DistutilsPlatformError( +- "calls to get_python_lib(standard_lib=1) cannot succeed") + if prefix is None: + prefix = PREFIX ++ if standard_lib: ++ return os.path.join(prefix, "lib-python", get_python_version()) + return os.path.join(prefix, 'site-packages') + + + diff --git a/dev-python/pypy-bin/files/1.9-getargs-freelist-c26dc70ee340.patch b/dev-python/pypy-bin/files/1.9-getargs-freelist-c26dc70ee340.patch new file mode 100644 index 000000000000..70619dce18f7 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-getargs-freelist-c26dc70ee340.patch @@ -0,0 +1,212 @@ +# HG changeset patch +# User Armin Rigo <arigo@tunes.org> +# Date 1339595299 -7200 +# Node ID c26dc70ee34018efeec8b789d40ec78478304bc0 +# Parent c7dff5469611f03946466caed17c567c4ea5d8d0 +Fix for the issue of abuse of PyCapsules, relying on immediate +destruction, as CPython does. This problem was first described in +https://bazaar.launchpad.net/~exarkun/pyopenssl/trunk/revision/166. +The fix is rather obvious and consist in a *negative* total amount +of lines :-/ + +diff -r c7dff5469611f03946466caed17c567c4ea5d8d0 -r c26dc70ee34018efeec8b789d40ec78478304bc0 pypy/module/cpyext/src/getargs.c +--- a/pypy/module/cpyext/src/getargs.c Wed Jun 13 13:19:05 2012 +0200 ++++ b/pypy/module/cpyext/src/getargs.c Wed Jun 13 15:48:19 2012 +0200 +@@ -24,14 +24,15 @@ + + + /* Forward */ ++typedef struct freelist_s freelist_t; + static int vgetargs1(PyObject *, const char *, va_list *, int); + static void seterror(int, const char *, int *, const char *, const char *); + static char *convertitem(PyObject *, const char **, va_list *, int, int *, +- char *, size_t, PyObject **); ++ char *, size_t, freelist_t **); + static char *converttuple(PyObject *, const char **, va_list *, int, +- int *, char *, size_t, int, PyObject **); ++ int *, char *, size_t, int, freelist_t **); + static char *convertsimple(PyObject *, const char **, va_list *, int, char *, +- size_t, PyObject **); ++ size_t, freelist_t **); + static Py_ssize_t convertbuffer(PyObject *, void **p, char **); + static int getbuffer(PyObject *, Py_buffer *, char**); + +@@ -128,72 +129,45 @@ + + /* Handle cleanup of allocated memory in case of exception */ + +-#define GETARGS_CAPSULE_NAME_CLEANUP_PTR "getargs.cleanup_ptr" +-#define GETARGS_CAPSULE_NAME_CLEANUP_BUFFER "getargs.cleanup_buffer" ++typedef void (*cleanup_fn)(void *); + +-static void +-cleanup_ptr(PyObject *self) +-{ +- void *ptr = PyCapsule_GetPointer(self, GETARGS_CAPSULE_NAME_CLEANUP_PTR); +- if (ptr) { +- PyMem_FREE(ptr); +- } +-} ++struct freelist_s { ++ void *ptr; ++ cleanup_fn destr; ++ struct freelist_s *next; ++}; + +-static void +-cleanup_buffer(PyObject *self) +-{ +- Py_buffer *ptr = (Py_buffer *)PyCapsule_GetPointer(self, GETARGS_CAPSULE_NAME_CLEANUP_BUFFER); +- if (ptr) { +- PyBuffer_Release(ptr); +- } +-} ++#define cleanup_ptr ((cleanup_fn)PyMem_FREE) ++#define cleanup_buffer ((cleanup_fn)PyBuffer_Release) + + static int +-addcleanup(void *ptr, PyObject **freelist, PyCapsule_Destructor destr) ++addcleanup(void *ptr, freelist_t **freelist, cleanup_fn destr) + { +- PyObject *cobj; +- const char *name; +- +- if (!*freelist) { +- *freelist = PyList_New(0); +- if (!*freelist) { +- destr(ptr); +- return -1; +- } +- } +- +- if (destr == cleanup_ptr) { +- name = GETARGS_CAPSULE_NAME_CLEANUP_PTR; +- } else if (destr == cleanup_buffer) { +- name = GETARGS_CAPSULE_NAME_CLEANUP_BUFFER; +- } else { +- return -1; +- } +- cobj = PyCapsule_New(ptr, name, destr); +- if (!cobj) { ++ freelist_t *node = PyMem_MALLOC(sizeof(freelist_t)); ++ if (!node) { + destr(ptr); + return -1; + } +- if (PyList_Append(*freelist, cobj)) { +- Py_DECREF(cobj); +- return -1; +- } +- Py_DECREF(cobj); ++ node->ptr = ptr; ++ node->destr = destr; ++ node->next = *freelist; ++ *freelist = node; + return 0; + } + + static int +-cleanreturn(int retval, PyObject *freelist) ++cleanreturn(int retval, freelist_t *freelist) + { +- if (freelist && retval != 0) { +- /* We were successful, reset the destructors so that they +- don't get called. */ +- Py_ssize_t len = PyList_GET_SIZE(freelist), i; +- for (i = 0; i < len; i++) +- PyCapsule_SetDestructor(PyList_GET_ITEM(freelist, i), NULL); ++ freelist_t *next; ++ while (freelist != NULL) { ++ if (retval == 0) { ++ /* Leaving with an error */ ++ freelist->destr(freelist->ptr); ++ } ++ next = freelist->next; ++ PyMem_FREE(freelist); ++ freelist = next; + } +- Py_XDECREF(freelist); + return retval; + } + +@@ -212,7 +186,7 @@ + const char *formatsave = format; + Py_ssize_t i, len; + char *msg; +- PyObject *freelist = NULL; ++ freelist_t *freelist = NULL; + int compat = flags & FLAG_COMPAT; + + assert(compat || (args != (PyObject*)NULL)); +@@ -412,7 +386,7 @@ + static char * + converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags, + int *levels, char *msgbuf, size_t bufsize, int toplevel, +- PyObject **freelist) ++ freelist_t **freelist) + { + int level = 0; + int n = 0; +@@ -488,7 +462,7 @@ + + static char * + convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags, +- int *levels, char *msgbuf, size_t bufsize, PyObject **freelist) ++ int *levels, char *msgbuf, size_t bufsize, freelist_t **freelist) + { + char *msg; + const char *format = *p_format; +@@ -569,7 +543,7 @@ + + static char * + convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, +- char *msgbuf, size_t bufsize, PyObject **freelist) ++ char *msgbuf, size_t bufsize, freelist_t **freelist) + { + /* For # codes */ + #define FETCH_SIZE int *q=NULL;Py_ssize_t *q2=NULL;\ +@@ -1534,7 +1508,8 @@ + const char *fname, *msg, *custom_msg, *keyword; + int min = INT_MAX; + int i, len, nargs, nkeywords; +- PyObject *freelist = NULL, *current_arg; ++ freelist_t *freelist = NULL; ++ PyObject *current_arg; + + assert(args != NULL && PyTuple_Check(args)); + assert(keywords == NULL || PyDict_Check(keywords)); +diff -r c7dff5469611f03946466caed17c567c4ea5d8d0 -r c26dc70ee34018efeec8b789d40ec78478304bc0 pypy/module/cpyext/test/test_getargs.py +--- a/pypy/module/cpyext/test/test_getargs.py Wed Jun 13 13:19:05 2012 +0200 ++++ b/pypy/module/cpyext/test/test_getargs.py Wed Jun 13 15:48:19 2012 +0200 +@@ -144,6 +144,31 @@ + assert 'foo\0bar\0baz' == pybuffer(buffer('foo\0bar\0baz')) + + ++ def test_pyarg_parse_string_fails(self): ++ """ ++ Test the failing case of PyArg_ParseTuple(): it must not keep ++ a reference on the PyObject passed in. ++ """ ++ pybuffer = self.import_parser( ++ ''' ++ Py_buffer buf1, buf2, buf3; ++ PyObject *result; ++ if (!PyArg_ParseTuple(args, "s*s*s*", &buf1, &buf2, &buf3)) { ++ return NULL; ++ } ++ Py_FatalError("should not get there"); ++ return NULL; ++ ''') ++ freed = [] ++ class freestring(str): ++ def __del__(self): ++ freed.append('x') ++ raises(TypeError, pybuffer, ++ freestring("string"), freestring("other string"), 42) ++ import gc; gc.collect() ++ assert freed == ['x', 'x'] ++ ++ + def test_pyarg_parse_charbuf_and_length(self): + """ + The `t#` format specifier can be used to parse a read-only 8-bit diff --git a/dev-python/pypy-bin/files/1.9-more-ignored-ops-146ddf82a279.patch b/dev-python/pypy-bin/files/1.9-more-ignored-ops-146ddf82a279.patch new file mode 100644 index 000000000000..146399d0e3ce --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-more-ignored-ops-146ddf82a279.patch @@ -0,0 +1,25 @@ +changeset: 55567:146ddf82a279 +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 10:33:19 2012 +0200 +summary: More ignored ops + +diff -r 04ea518e5b71 -r 146ddf82a279 pypy/translator/c/gcc/trackgcroot.py +--- a/pypy/translator/c/gcc/trackgcroot.py Mon Jun 11 10:28:26 2012 +0200 ++++ b/pypy/translator/c/gcc/trackgcroot.py Mon Jun 11 10:33:19 2012 +0200 +@@ -476,13 +476,13 @@ + # floating-point operations cannot produce GC pointers + 'f', + 'cvt', 'ucomi', 'comi', 'subs', 'subp' , 'adds', 'addp', 'xorp', +- 'movap', 'movd', 'movlp', 'sqrtsd', 'movhpd', ++ 'movap', 'movd', 'movlp', 'sqrt', 'rsqrt', 'movhpd', + 'mins', 'minp', 'maxs', 'maxp', 'unpck', 'pxor', 'por', # sse2 + 'shufps', 'shufpd', + # arithmetic operations should not produce GC pointers + 'inc', 'dec', 'not', 'neg', 'or', 'and', 'sbb', 'adc', + 'shl', 'shr', 'sal', 'sar', 'rol', 'ror', 'mul', 'imul', 'div', 'idiv', +- 'bswap', 'bt', 'rdtsc', ++ 'bswap', 'bt', 'rdtsc', 'rounds', + 'pabs', 'pack', 'padd', 'palign', 'pand', 'pavg', 'pcmp', 'pextr', + 'phadd', 'phsub', 'pinsr', 'pmadd', 'pmax', 'pmin', 'pmovmsk', + 'pmul', 'por', 'psadb', 'pshuf', 'psign', 'psll', 'psra', 'psrl', + diff --git a/dev-python/pypy-bin/files/1.9-more-ignored-ops-a9a8faa76bca.patch b/dev-python/pypy-bin/files/1.9-more-ignored-ops-a9a8faa76bca.patch new file mode 100644 index 000000000000..51a53ca06cff --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-more-ignored-ops-a9a8faa76bca.patch @@ -0,0 +1,32 @@ +changeset: 55523:a9a8faa76bca +parent: 55518:f0daafccddc5 +user: Armin Rigo <arigo@tunes.org> +date: Fri Jun 08 19:55:01 2012 +0200 +summary: Add more instructions to ignore by copying from Intel docs. + +diff -r f0daafccddc5 -r a9a8faa76bca pypy/translator/c/gcc/trackgcroot.py +--- a/pypy/translator/c/gcc/trackgcroot.py Fri Jun 08 18:30:54 2012 +0200 ++++ b/pypy/translator/c/gcc/trackgcroot.py Fri Jun 08 19:55:01 2012 +0200 +@@ -483,8 +483,10 @@ + 'inc', 'dec', 'not', 'neg', 'or', 'and', 'sbb', 'adc', + 'shl', 'shr', 'sal', 'sar', 'rol', 'ror', 'mul', 'imul', 'div', 'idiv', + 'bswap', 'bt', 'rdtsc', +- 'punpck', 'pshufd', 'pcmp', 'pand', 'psllw', 'pslld', 'psllq', +- 'paddq', 'pinsr', 'pmul', 'psrl', ++ 'pabs', 'pack', 'padd', 'palign', 'pand', 'pavg', 'pcmp', 'pextr', ++ 'phadd', 'phsub', 'pinsr', 'pmadd', 'pmax', 'pmin', 'pmovmsk', ++ 'pmul', 'por', 'psadb', 'pshuf', 'psign', 'psll', 'psra', 'psrl', ++ 'psub', 'punpck', 'pxor', + # all vectors don't produce pointers + 'v', + # sign-extending moves should not produce GC pointers +@@ -492,7 +494,7 @@ + # zero-extending moves should not produce GC pointers + 'movz', + # locked operations should not move GC pointers, at least so far +- 'lock', ++ 'lock', 'pause', + ]) + + # a partial list is hopefully good enough for now; it's all to support + diff --git a/dev-python/pypy-bin/files/1.9-no-bytecode-4151f9c406b6.patch b/dev-python/pypy-bin/files/1.9-no-bytecode-4151f9c406b6.patch new file mode 100644 index 000000000000..5fab3a50ddad --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-no-bytecode-4151f9c406b6.patch @@ -0,0 +1,27 @@ +# HG changeset patch +# User Armin Rigo <arigo@tunes.org> +# Date 1339165065 -7200 +# Node ID 4151f9c406b62f6c4a1fdd669389eb46eb90f9cb +# Parent 68f8d7152a45fa7856a2a013799874614fcd9c33 +issue1043 3rd issue fixed + +diff -r 68f8d7152a45fa7856a2a013799874614fcd9c33 -r 4151f9c406b62f6c4a1fdd669389eb46eb90f9cb pypy/translator/goal/app_main.py +--- a/pypy/translator/goal/app_main.py Fri Jun 08 16:06:33 2012 +0200 ++++ b/pypy/translator/goal/app_main.py Fri Jun 08 16:17:45 2012 +0200 +@@ -457,13 +457,13 @@ + + if PYTHON26 and not options["ignore_environment"]: + if os.getenv('PYTHONNOUSERSITE'): +- options["no_user_site"] = True ++ options["no_user_site"] = 1 + if os.getenv('PYTHONDONTWRITEBYTECODE'): +- options["dont_write_bytecode"] = True ++ options["dont_write_bytecode"] = 1 + + if (options["interactive"] or + (not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))): +- options["inspect"] = True ++ options["inspect"] = 1 + + if PYTHON26 and we_are_translated(): + flags = [options[flag] for flag in sys_flags] diff --git a/dev-python/pypy-bin/files/1.9-no-static-hack.patch b/dev-python/pypy-bin/files/1.9-no-static-hack.patch new file mode 100644 index 000000000000..fe75ac296000 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-no-static-hack.patch @@ -0,0 +1,30 @@ +Remove logic that links to libssl and libcrypto statically if +possible. Just always link dynamically: Gentoo is expected to have +sane dynamic libraries for us to use, and our users are not expected +to copy their pypy binary to a system with an incompatible +libssl/libcrypto and expect it to work. + +Patch contributed by XU Benda <heroxbd@gentoo.org>. + +--- pypy/rlib/ropenssl.py 2012-06-07 21:24:48.000000000 +0900 ++++ pypy/rlib/ropenssl.py.new 2012-06-10 17:28:29.000000000 +0900 +@@ -19,18 +19,8 @@ if sys.platform == 'win32' and platform. + # so that openssl/ssl.h can repair this nonsense. + 'wincrypt.h'] + else: +- libraries = ['z'] ++ libraries = ['z', 'ssl', 'crypto'] + includes = [] +- if (sys.platform.startswith('linux') and +- os.path.exists('/usr/lib/libssl.a') and +- os.path.exists('/usr/lib/libcrypto.a')): +- # use static linking to avoid the infinite +- # amount of troubles due to symbol versions +- # and 0.9.8/1.0.0 +- link_files += ['/usr/lib/libssl.a', '/usr/lib/libcrypto.a'] +- testonly_libraries += ['ssl', 'crypto'] +- else: +- libraries += ['ssl', 'crypto'] + + includes += [ + 'openssl/ssl.h', diff --git a/dev-python/pypy-bin/files/1.9-pybuffer-release-double-decref-4ec2a5b49386.patch b/dev-python/pypy-bin/files/1.9-pybuffer-release-double-decref-4ec2a5b49386.patch new file mode 100644 index 000000000000..58c301e4d04f --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-pybuffer-release-double-decref-4ec2a5b49386.patch @@ -0,0 +1,29 @@ +changeset: 55598:4ec2a5b49386 +tag: tip +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 19:54:04 2012 +0200 +summary: Test and fix (thanks marienz) + +diff -r cdb2d1b3d0da -r 4ec2a5b49386 pypy/module/cpyext/object.py +--- a/pypy/module/cpyext/object.py Mon Jun 11 19:41:35 2012 +0200 ++++ b/pypy/module/cpyext/object.py Mon Jun 11 19:54:04 2012 +0200 +@@ -489,3 +489,4 @@ + provides a subset of CPython's behavior. + """ + Py_DecRef(space, view.c_obj) ++ view.c_obj = lltype.nullptr(PyObject.TO) +diff -r cdb2d1b3d0da -r 4ec2a5b49386 pypy/module/cpyext/test/test_object.py +--- a/pypy/module/cpyext/test/test_object.py Mon Jun 11 19:41:35 2012 +0200 ++++ b/pypy/module/cpyext/test/test_object.py Mon Jun 11 19:54:04 2012 +0200 +@@ -363,6 +363,10 @@ + * Py_buffer and the string should be released as well. + */ + PyBuffer_Release(&buf); ++ assert(!buf.obj); ++ PyBuffer_Release(&buf); /* call again, should not have any more effect */ ++ PyBuffer_Release(&buf); ++ PyBuffer_Release(&buf); + + Py_RETURN_NONE; + """)]) + diff --git a/dev-python/pypy-bin/files/1.9-scripts-location.patch b/dev-python/pypy-bin/files/1.9-scripts-location.patch new file mode 100644 index 000000000000..5f0190d9a20f --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-scripts-location.patch @@ -0,0 +1,11 @@ +--- pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py ++++ pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py +@@ -87,7 +87,7 @@ + 'purelib': '$base/site-packages', + 'platlib': '$base/site-packages', + 'headers': '$base/include', +- 'scripts': '$base/bin', ++ 'scripts': '/usr/bin', + 'data' : '$base', + }, + } diff --git a/dev-python/pypy-bin/files/1.9-signal-a33052b17f4e.patch b/dev-python/pypy-bin/files/1.9-signal-a33052b17f4e.patch new file mode 100644 index 000000000000..6087122a4a69 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-signal-a33052b17f4e.patch @@ -0,0 +1,65 @@ +changeset: 55595:a33052b17f4e +parent: 55589:4f58f2db96c0 +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 18:06:35 2012 +0200 +summary: issue1167: changed the test (according to py.test -A on Linux), and fix + +diff -r 4f58f2db96c0 -r a33052b17f4e pypy/module/signal/interp_signal.py +--- a/pypy/module/signal/interp_signal.py Mon Jun 11 17:05:01 2012 +0200 ++++ b/pypy/module/signal/interp_signal.py Mon Jun 11 18:06:35 2012 +0200 +@@ -227,7 +227,7 @@ + None -- if an unknown handler is in effect (XXX UNIMPLEMENTED) + anything else -- the callable Python object used as a handler + """ +- check_signum(space, signum) ++ check_signum_in_range(space, signum) + action = space.check_signal_action + if signum in action.handlers_w: + return action.handlers_w[signum] +@@ -253,12 +253,18 @@ + c_pause() + return space.w_None + +-def check_signum(space, signum): ++def check_signum_exists(space, signum): + if signum in signal_values: + return + raise OperationError(space.w_ValueError, + space.wrap("invalid signal value")) + ++def check_signum_in_range(space, signum): ++ if 1 <= signum < NSIG: ++ return ++ raise OperationError(space.w_ValueError, ++ space.wrap("signal number out of range")) ++ + + @jit.dont_look_inside + @unwrap_spec(signum=int) +@@ -319,7 +325,7 @@ + + @unwrap_spec(signum=int, flag=int) + def siginterrupt(space, signum, flag): +- check_signum(space, signum) ++ check_signum_exists(space, signum) + if rffi.cast(lltype.Signed, c_siginterrupt(signum, flag)) < 0: + errno = rposix.get_errno() + raise OperationError(space.w_RuntimeError, space.wrap(errno)) +diff -r 4f58f2db96c0 -r a33052b17f4e pypy/module/signal/test/test_signal.py +--- a/pypy/module/signal/test/test_signal.py Mon Jun 11 17:05:01 2012 +0200 ++++ b/pypy/module/signal/test/test_signal.py Mon Jun 11 18:06:35 2012 +0200 +@@ -154,7 +154,12 @@ + + raises(ValueError, getsignal, 4444) + raises(ValueError, signal, 4444, lambda *args: None) +- raises(ValueError, signal, 42, lambda *args: None) ++ import sys ++ if sys.platform == 'win32': ++ raises(ValueError, signal, 42, lambda *args: None) ++ else: ++ signal(42, lambda *args: None) ++ signal(42, SIG_DFL) + + def test_alarm(self): + try: + diff --git a/dev-python/pypy-bin/files/1.9-ssl-errors-25d3418150d2.patch b/dev-python/pypy-bin/files/1.9-ssl-errors-25d3418150d2.patch new file mode 100644 index 000000000000..78affe9d3815 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-ssl-errors-25d3418150d2.patch @@ -0,0 +1,34 @@ +# HG changeset patch +# User Amaury Forgeot d'Arc <amauryfa@gmail.com> +# Date 1339449304 -7200 +# Node ID 25d3418150d2e2820913043432f568e31bf3a19a +# Parent 33c305197a3d05217be023fa39a692ad89802317 +issue1169: _ssl errors outside any SSL context should use ERR_peek_last_error() + +diff -r 33c305197a3d05217be023fa39a692ad89802317 -r 25d3418150d2e2820913043432f568e31bf3a19a pypy/module/_ssl/interp_ssl.py +--- a/pypy/module/_ssl/interp_ssl.py Mon Jun 11 23:01:31 2012 +0200 ++++ b/pypy/module/_ssl/interp_ssl.py Mon Jun 11 23:15:04 2012 +0200 +@@ -789,7 +789,11 @@ + def _ssl_seterror(space, ss, ret): + assert ret <= 0 + +- if ss and ss.ssl: ++ if ss is None: ++ errval = libssl_ERR_peek_last_error() ++ errstr = rffi.charp2str(libssl_ERR_error_string(errval, None)) ++ return ssl_error(space, errstr, errval) ++ elif ss.ssl: + err = libssl_SSL_get_error(ss.ssl, ret) + else: + err = SSL_ERROR_SSL +diff -r 33c305197a3d05217be023fa39a692ad89802317 -r 25d3418150d2e2820913043432f568e31bf3a19a pypy/rlib/ropenssl.py +--- a/pypy/rlib/ropenssl.py Mon Jun 11 23:01:31 2012 +0200 ++++ b/pypy/rlib/ropenssl.py Mon Jun 11 23:15:04 2012 +0200 +@@ -259,6 +259,7 @@ + ssl_external('SSL_CIPHER_get_bits', [SSL_CIPHER, rffi.INTP], rffi.INT) + + ssl_external('ERR_get_error', [], rffi.INT) ++ssl_external('ERR_peek_last_error', [], rffi.INT) + ssl_external('ERR_error_string', [rffi.ULONG, rffi.CCHARP], rffi.CCHARP) + + ssl_external('SSL_free', [SSL], lltype.Void) diff --git a/dev-python/pypy-bin/files/1.9-ssl-threads-1-34b3b5aac082.patch b/dev-python/pypy-bin/files/1.9-ssl-threads-1-34b3b5aac082.patch new file mode 100644 index 000000000000..ac5d7ad50030 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-ssl-threads-1-34b3b5aac082.patch @@ -0,0 +1,143 @@ +changeset: 55575:34b3b5aac082 +parent: 55569:fa8262a5746a +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 14:38:35 2012 +0200 +summary: Move the callback logic to C code instead of using RPython code + +diff -r fa8262a5746a -r 34b3b5aac082 pypy/module/_ssl/__init__.py +--- a/pypy/module/_ssl/__init__.py Mon Jun 11 11:04:53 2012 +0200 ++++ b/pypy/module/_ssl/__init__.py Mon Jun 11 14:38:35 2012 +0200 +@@ -31,5 +31,6 @@ + def startup(self, space): + from pypy.rlib.ropenssl import init_ssl + init_ssl() +- from pypy.module._ssl.interp_ssl import setup_ssl_threads +- setup_ssl_threads() ++ if space.config.objspace.usemodules.thread: ++ from pypy.module._ssl.thread_lock import setup_ssl_threads ++ setup_ssl_threads() +diff -r fa8262a5746a -r 34b3b5aac082 pypy/module/_ssl/interp_ssl.py +--- a/pypy/module/_ssl/interp_ssl.py Mon Jun 11 11:04:53 2012 +0200 ++++ b/pypy/module/_ssl/interp_ssl.py Mon Jun 11 14:38:35 2012 +0200 +@@ -880,38 +880,3 @@ + libssl_X509_free(x) + finally: + libssl_BIO_free(cert) +- +-# this function is needed to perform locking on shared data +-# structures. (Note that OpenSSL uses a number of global data +-# structures that will be implicitly shared whenever multiple threads +-# use OpenSSL.) Multi-threaded applications will crash at random if +-# it is not set. +-# +-# locking_function() must be able to handle up to CRYPTO_num_locks() +-# different mutex locks. It sets the n-th lock if mode & CRYPTO_LOCK, and +-# releases it otherwise. +-# +-# filename and line are the file number of the function setting the +-# lock. They can be useful for debugging. +-_ssl_locks = [] +- +-def _ssl_thread_locking_function(mode, n, filename, line): +- n = intmask(n) +- if n < 0 or n >= len(_ssl_locks): +- return +- +- if intmask(mode) & CRYPTO_LOCK: +- _ssl_locks[n].acquire(True) +- else: +- _ssl_locks[n].release() +- +-def _ssl_thread_id_function(): +- from pypy.module.thread import ll_thread +- return rffi.cast(rffi.LONG, ll_thread.get_ident()) +- +-def setup_ssl_threads(): +- from pypy.module.thread import ll_thread +- for i in range(libssl_CRYPTO_num_locks()): +- _ssl_locks.append(ll_thread.allocate_lock()) +- libssl_CRYPTO_set_locking_callback(_ssl_thread_locking_function) +- libssl_CRYPTO_set_id_callback(_ssl_thread_id_function) +diff -r fa8262a5746a -r 34b3b5aac082 pypy/module/_ssl/thread_lock.py +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/pypy/module/_ssl/thread_lock.py Mon Jun 11 14:38:35 2012 +0200 +@@ -0,0 +1,78 @@ ++from pypy.rlib.ropenssl import * ++from pypy.rpython.lltypesystem import lltype, rffi ++from pypy.translator.tool.cbuild import ExternalCompilationInfo ++ ++# CRYPTO_set_locking_callback: ++# ++# this function is needed to perform locking on shared data ++# structures. (Note that OpenSSL uses a number of global data ++# structures that will be implicitly shared whenever multiple threads ++# use OpenSSL.) Multi-threaded applications will crash at random if ++# it is not set. ++# ++# locking_function() must be able to handle up to CRYPTO_num_locks() ++# different mutex locks. It sets the n-th lock if mode & CRYPTO_LOCK, and ++# releases it otherwise. ++# ++# filename and line are the file number of the function setting the ++# lock. They can be useful for debugging. ++ ++ ++# This logic is moved to C code so that the callbacks can be invoked ++# without caring about the GIL. ++ ++separate_module_source = """ ++ ++#include <openssl/crypto.h> ++ ++static unsigned int _ssl_locks_count = 0; ++static struct RPyOpaque_ThreadLock *_ssl_locks; ++ ++static unsigned long _ssl_thread_id_function(void) { ++ return RPyThreadGetIdent(); ++} ++ ++static void _ssl_thread_locking_function(int mode, int n, const char *file, ++ int line) { ++ if ((_ssl_locks == NULL) || ++ (n < 0) || ((unsigned)n >= _ssl_locks_count)) ++ return; ++ ++ if (mode & CRYPTO_LOCK) { ++ RPyThreadAcquireLock(_ssl_locks[n], 1); ++ } else { ++ RPyThreadReleaseLock(_ssl_locks[n]); ++ } ++} ++ ++int _PyPy_SSL_SetupThreads(void) ++{ ++ unsigned int i; ++ _ssl_locks_count = CRYPTO_num_locks(); ++ _ssl_locks = calloc(_ssl_locks_count, sizeof(struct RPyOpaque_ThreadLock)); ++ if (_ssl_locks == NULL) ++ return 0; ++ for (i=0; i<_ssl_locks_count; i++) { ++ if (RPyThreadLockInit(_ssl_locks + i) == 0) ++ return 0; ++ } ++ CRYPTO_set_locking_callback(_ssl_thread_locking_function); ++ CRYPTO_set_id_callback(_ssl_thread_id_function); ++ return 1; ++} ++""" ++ ++ ++eci = ExternalCompilationInfo( ++ separate_module_sources=[separate_module_source], ++ export_symbols=['_PyPy_SSL_SetupThreads'], ++) ++ ++_PyPy_SSL_SetupThreads = rffi.llexternal('_PyPy_SSL_SetupThreads', ++ [], rffi.INT, ++ compilation_info=eci) ++ ++def setup_ssl_threads(): ++ result = _PyPy_SSL_SetupThreads() ++ if rffi.cast(lltype.Signed, result) == 0: ++ raise MemoryError + diff --git a/dev-python/pypy-bin/files/1.9-ssl-threads-2-25cd11066d95.patch b/dev-python/pypy-bin/files/1.9-ssl-threads-2-25cd11066d95.patch new file mode 100644 index 000000000000..a1878f3565c2 --- /dev/null +++ b/dev-python/pypy-bin/files/1.9-ssl-threads-2-25cd11066d95.patch @@ -0,0 +1,22 @@ +changeset: 55578:25cd11066d95 +tag: tip +user: Armin Rigo <arigo@tunes.org> +date: Mon Jun 11 15:19:38 2012 +0200 +summary: Fix. + +diff -r e701bca5f3b9 -r 25cd11066d95 pypy/module/_ssl/thread_lock.py +--- a/pypy/module/_ssl/thread_lock.py Mon Jun 11 15:01:00 2012 +0200 ++++ b/pypy/module/_ssl/thread_lock.py Mon Jun 11 15:19:38 2012 +0200 +@@ -39,9 +39,9 @@ + return; + + if (mode & CRYPTO_LOCK) { +- RPyThreadAcquireLock(_ssl_locks[n], 1); ++ RPyThreadAcquireLock(_ssl_locks + n, 1); + } else { +- RPyThreadReleaseLock(_ssl_locks[n]); ++ RPyThreadReleaseLock(_ssl_locks + n); + } + } + + diff --git a/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch b/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch new file mode 100644 index 000000000000..db7db3bad7fe --- /dev/null +++ b/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch @@ -0,0 +1,323 @@ +http://bugs.python.org/issue1222585 + +--- lib-python/2.7/distutils/cygwinccompiler.py ++++ lib-python/2.7/distutils/cygwinccompiler.py +@@ -132,9 +132,13 @@ + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -160,8 +164,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -322,10 +330,15 @@ + self.set_executables(compiler='gcc -mno-cygwin -O -Wall', + compiler_so='gcc -mno-cygwin -mdll -O -Wall', + compiler_cxx='g++ -mno-cygwin -O -Wall', ++ compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall', + linker_exe='gcc -mno-cygwin', + linker_so='%s -mno-cygwin %s %s' + % (self.linker_dll, shared_option, +- entry_point)) ++ entry_point), ++ linker_exe_cxx='g++ -mno-cygwin', ++ linker_so_cxx='%s -mno-cygwin %s %s' ++ % (self.linker_dll, shared_option, ++ entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) + # (-mthreads: Support thread-safe exception handling on `Mingw32') +--- lib-python/2.7/distutils/emxccompiler.py ++++ lib-python/2.7/distutils/emxccompiler.py +@@ -65,8 +65,12 @@ + # XXX optimization, warnings etc. should be customizable. + self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + linker_exe='gcc -Zomf -Zmt -Zcrtdll', +- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') ++ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll', ++ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll', ++ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll') + + # want the gcc library statically linked (so that we don't have + # to distribute a version dependent on the compiler we have) +@@ -83,8 +87,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +--- lib-python/2.7/distutils/sysconfig_cpython.py ++++ lib-python/2.7/distutils/sysconfig_cpython.py +@@ -150,10 +150,12 @@ + varies across Unices and is stored in Python's Makefile. + """ + if compiler.compiler_type == "unix": +- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SO', 'AR', +- 'ARFLAGS') ++ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SO', 'AR', 'ARFLAGS') ++ ++ cflags = '' ++ cxxflags = '' + + newcc = None + if 'CC' in os.environ: +@@ -191,19 +193,27 @@ + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = opt + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -212,13 +222,17 @@ + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = so_ext +@@ -530,7 +544,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = re.sub('-isysroot [^ \t]*', ' ', flags) +@@ -549,7 +563,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) +@@ -573,7 +587,7 @@ + for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', + # a number of derived variables. These need to be + # patched up as well. +- 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): ++ 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags) +--- lib-python/2.7/distutils/sysconfig_pypy.py ++++ lib-python/2.7/distutils/sysconfig_pypy.py +@@ -114,13 +114,56 @@ + optional C speedup components. + """ + if compiler.compiler_type == "unix": +- compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit']) ++ cc = ' '.join(compiler.compiler) ++ cxx = ' '.join(compiler.compiler_cxx) ++ ldshared = ' '.join(compiler.linker_so) ++ ldcxxshared = ' '.join(compiler.linker_so_cxx) ++ ++ cflags = '' ++ cxxflags = '' ++ ccshared = '-fPIC' ++ ++ if 'CC' in os.environ: ++ cc = os.environ['CC'] ++ if 'CXX' in os.environ: ++ cxx = os.environ['CXX'] ++ if 'LDSHARED' in os.environ: ++ ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] ++ if 'CPP' in os.environ: ++ cpp = os.environ['CPP'] ++ else: ++ cpp = cc + " -E" # not always ++ if 'LDFLAGS' in os.environ: ++ ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] ++ if 'CFLAGS' in os.environ: ++ cflags = os.environ['CFLAGS'] ++ ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] ++ if 'CPPFLAGS' in os.environ: ++ cpp = cpp + ' ' + os.environ['CPPFLAGS'] ++ cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] ++ ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] ++ ++ cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags ++ compiler.set_executables( ++ preprocessor=cpp, ++ compiler=cc_cmd, ++ compiler_so=cc_cmd + ' ' + ccshared, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, ++ linker_so=ldshared, ++ linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx) + compiler.shared_lib_extension = get_config_var('SO') +- if "CFLAGS" in os.environ: +- cflags = os.environ["CFLAGS"] +- compiler.compiler.append(cflags) +- compiler.compiler_so.append(cflags) +- compiler.linker_so.append(cflags) + + + from sysconfig_cpython import ( +--- lib-python/2.7/distutils/unixccompiler.py ++++ lib-python/2.7/distutils/unixccompiler.py +@@ -114,14 +114,17 @@ + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -171,11 +174,18 @@ + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) ++ compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args + ++ extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -232,23 +242,16 @@ + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i = i + 1 +- +- linker[i] = self.compiler_cxx[i] ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] ++ else: ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _darwin_compiler_fixup(linker, ld_args) diff --git a/dev-python/pypy-bin/metadata.xml b/dev-python/pypy-bin/metadata.xml new file mode 100644 index 000000000000..a644c3a74f86 --- /dev/null +++ b/dev-python/pypy-bin/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>python</herd> + <use> + <flag name="shadowstack">Use a shadow stack for finding GC roots</flag> + </use> +</pkgmetadata> diff --git a/dev-python/pypy-bin/pypy-bin-1.9.ebuild b/dev-python/pypy-bin/pypy-bin-1.9.ebuild new file mode 100644 index 000000000000..46a09911a505 --- /dev/null +++ b/dev-python/pypy-bin/pypy-bin-1.9.ebuild @@ -0,0 +1,155 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy-bin/pypy-bin-1.9.ebuild,v 1.1 2013/07/27 11:19:19 mgorny Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy{1_8,1_9,2_0} ) +inherit eutils multilib pax-utils python-any-r1 vcs-snapshot versionator + +BINHOST="http://dev.gentoo.org/~mgorny/dist/${PN}" + +DESCRIPTION="A fast, compliant alternative implementation of the Python language (binary package)" +HOMEPAGE="http://pypy.org/" +SRC_URI="https://bitbucket.org/pypy/pypy/get/release-${PV}.tar.bz2 -> pypy-${PV}.tar.bz2 + amd64? ( + jit? ( shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+jit+ncurses+shadowstack.tar.xz + ) ) + jit? ( !shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.xz + ) ) + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.xz + ) ) + ) + x86? ( + sse2? ( + jit? ( shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+jit+ncurses+shadowstack+sse2.tar.xz + ) ) + jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+jit+ncurses+sse2.tar.xz + ) ) + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+ncurses+sse2.tar.xz + ) ) + ) + !sse2? ( + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+ncurses.tar.xz + ) ) + ) + )" + +# Supported variants +REQUIRED_USE="!jit? ( !shadowstack ) + x86? ( !sse2? ( !jit !shadowstack ) )" + +LICENSE="MIT" +SLOT=$(get_version_component_range 1-2 ${PV}) +KEYWORDS="~amd64 ~x86" +IUSE="doc +jit shadowstack sqlite sse2 test" + +RDEPEND=" + ~app-arch/bzip2-1.0.6 + ~dev-libs/expat-2.1.0 + || ( ~dev-libs/libffi-3.0.13 + ~dev-libs/libffi-3.0.12 + ~dev-libs/libffi-3.0.11 ) + || ( ~dev-libs/openssl-1.0.1e + ~dev-libs/openssl-1.0.1d + ~dev-libs/openssl-1.0.1c ) + || ( ~sys-libs/glibc-2.17 + ~sys-libs/glibc-2.16.0 + ~sys-libs/glibc-2.15 ) + ~sys-libs/ncurses-5.9 + || ( ~sys-libs/zlib-1.2.8 + ~sys-libs/zlib-1.2.7 ) + sqlite? ( dev-db/sqlite:3 ) + !dev-python/pypy:${SLOT}" +DEPEND="doc? ( dev-python/sphinx ) + test? ( ${RDEPEND} )" +PDEPEND="app-admin/python-updater" + +S=${WORKDIR}/pypy-${PV} + +pkg_setup() { + use doc && python-any-r1_pkg_setup +} + +src_prepare() { + epatch "${FILESDIR}/${PV}-no-bytecode-4151f9c406b6.patch" + epatch "${FILESDIR}/${PV}-scripts-location.patch" + epatch "${FILESDIR}/${PV}-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" + epatch "${FILESDIR}/${PV}-distutils-fix_handling_of_executables_and_flags.patch" + epatch "${FILESDIR}/${PV}-ssl-threads-1-34b3b5aac082.patch" + epatch "${FILESDIR}/${PV}-ssl-threads-2-25cd11066d95.patch" + epatch "${FILESDIR}/${PV}-get_python_lib_standard_lib-04ea518e5b71.patch" + epatch "${FILESDIR}/${PV}-more-ignored-ops-a9a8faa76bca.patch" + epatch "${FILESDIR}/${PV}-more-ignored-ops-146ddf82a279.patch" + epatch "${FILESDIR}/${PV}-pybuffer-release-double-decref-4ec2a5b49386.patch" + epatch "${FILESDIR}/${PV}-signal-a33052b17f4e.patch" + epatch "${FILESDIR}/${PV}-getargs-freelist-c26dc70ee340.patch" + epatch "${FILESDIR}/${PV}-ssl-errors-25d3418150d2.patch" + + # The following is Gentoo-specific. + epatch "${FILESDIR}/${PV}-no-static-hack.patch" + + epatch_user +} + +src_compile() { + # Tadaam! PyPy compiled! + mv "${WORKDIR}"/${P}*/pypy-c . || die + mv "${WORKDIR}"/${P}*/include/*.h include/ || die + mv pypy/module/cpyext/include/*.h include/ || die + + use doc && emake -C pypy/doc/ html +} + +src_test() { + # (unset) + local -x PYTHONDONTWRITEBYTECODE + + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die +} + +src_install() { + einfo "Installing PyPy ..." + insinto "/usr/$(get_libdir)/pypy${SLOT}" + doins -r include lib_pypy lib-python pypy-c + fperms a+x ${INSDESTTREE}/pypy-c + use jit && pax-mark m "${ED%/}${INSDESTTREE}/pypy-c" + dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT} + dosym ../$(get_libdir)/pypy${SLOT}/include /usr/include/pypy${SLOT} + dodoc README + + if ! use sqlite; then + rm -r "${ED%/}${INSDESTTREE}"/lib-python/*2.7/sqlite3 || die + rm "${ED%/}${INSDESTTREE}"/lib_pypy/_sqlite3.py || die + fi + + # Install docs + use doc && dohtml -r pypy/doc/_build/html/ + + einfo "Generating caches and byte-compiling ..." + + python_export pypy-c${SLOT} EPYTHON PYTHON PYTHON_SITEDIR + local PYTHON=${ED%/}${INSDESTTREE}/pypy-c + + echo "EPYTHON='${EPYTHON}'" > epython.py + python_domodule epython.py + + # Note: call portage helpers before this line. + # PYTHONPATH confuses them and will result in random failures. + + local -x PYTHONPATH="${ED%/}${INSDESTTREE}/lib_pypy:${ED%/}${INSDESTTREE}/lib-python/2.7" + + # Generate Grammar and PatternGrammar pickles. + "${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \ + || die "Generation of Grammar and PatternGrammar pickles failed" + + # compile the installed modules + python_optimize "${ED%/}${INSDESTTREE}" +} diff --git a/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild new file mode 100644 index 000000000000..a58dd5dfed08 --- /dev/null +++ b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild @@ -0,0 +1,148 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild,v 1.3 2013/07/27 11:19:19 mgorny Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy{1_8,1_9,2_0} ) +inherit eutils multilib pax-utils python-any-r1 versionator + +BINHOST="http://dev.gentoo.org/~mgorny/dist/${PN}" + +DESCRIPTION="A fast, compliant alternative implementation of the Python language (binary package)" +HOMEPAGE="http://pypy.org/" +SRC_URI="mirror://bitbucket/pypy/pypy/downloads/pypy-${PV}-src.tar.bz2 + amd64? ( + jit? ( shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+jit+ncurses+shadowstack.tar.xz + ) ) + jit? ( !shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.xz + ) ) + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.xz + ) ) + ) + x86? ( + sse2? ( + jit? ( shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+jit+ncurses+shadowstack+sse2.tar.xz + ) ) + jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+jit+ncurses+sse2.tar.xz + ) ) + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+ncurses+sse2.tar.xz + ) ) + ) + !sse2? ( + !jit? ( !shadowstack? ( + ${BINHOST}/${P}-x86+bzip2+ncurses.tar.xz + ) ) + ) + )" + +# Supported variants +REQUIRED_USE="!jit? ( !shadowstack ) + x86? ( !sse2? ( !jit !shadowstack ) )" + +LICENSE="MIT" +SLOT=$(get_version_component_range 1-2 ${PV}) +KEYWORDS="~amd64 ~x86" +IUSE="doc +jit shadowstack sqlite sse2 test" + +RDEPEND=" + ~app-arch/bzip2-1.0.6 + ~dev-libs/expat-2.1.0 + || ( ~dev-libs/libffi-3.0.13 + ~dev-libs/libffi-3.0.12 + ~dev-libs/libffi-3.0.11 ) + || ( ~dev-libs/openssl-1.0.1e + ~dev-libs/openssl-1.0.1d + ~dev-libs/openssl-1.0.1c ) + || ( ~sys-libs/glibc-2.17 + ~sys-libs/glibc-2.16.0 + ~sys-libs/glibc-2.15 ) + ~sys-libs/ncurses-5.9 + || ( ~sys-libs/zlib-1.2.8 + ~sys-libs/zlib-1.2.7 ) + sqlite? ( dev-db/sqlite:3 ) + !dev-python/pypy:${SLOT}" +DEPEND="doc? ( dev-python/sphinx ) + test? ( ${RDEPEND} )" +PDEPEND="app-admin/python-updater" + +S=${WORKDIR}/pypy-${PV}-src + +pkg_setup() { + use doc && python-any-r1_pkg_setup +} + +src_prepare() { + epatch "${FILESDIR}/1.9-scripts-location.patch" + epatch "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" + epatch "${FILESDIR}/2.0.2-distutils-fix_handling_of_executables_and_flags.patch" + + epatch_user +} + +src_compile() { + # Tadaam! PyPy compiled! + mv "${WORKDIR}"/${P}*/pypy-c . || die + mv "${WORKDIR}"/${P}*/include/*.h include/ || die + mv pypy/module/cpyext/include/*.h include/ || die + + use doc && emake -C pypy/doc/ html +} + +src_test() { + # (unset) + local -x PYTHONDONTWRITEBYTECODE + + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die +} + +src_install() { + einfo "Installing PyPy ..." + insinto "/usr/$(get_libdir)/pypy${SLOT}" + doins -r include lib_pypy lib-python pypy-c + fperms a+x ${INSDESTTREE}/pypy-c + use jit && pax-mark m "${ED%/}${INSDESTTREE}/pypy-c" + dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT} + dosym ../$(get_libdir)/pypy${SLOT}/include /usr/include/pypy${SLOT} + dodoc README.rst + + if ! use sqlite; then + rm -r "${ED%/}${INSDESTTREE}"/lib-python/*2.7/sqlite3 || die + rm "${ED%/}${INSDESTTREE}"/lib_pypy/_sqlite3.py || die + fi + + # Install docs + use doc && dohtml -r pypy/doc/_build/html/ + + einfo "Generating caches and byte-compiling ..." + + python_export pypy-c${SLOT} EPYTHON PYTHON PYTHON_SITEDIR + local PYTHON=${ED%/}${INSDESTTREE}/pypy-c + + echo "EPYTHON='${EPYTHON}'" > epython.py + python_domodule epython.py + + # Note: call portage helpers before this line. + # PYTHONPATH confuses them and will result in random failures. + + local -x PYTHONPATH="${ED%/}${INSDESTTREE}/lib_pypy:${ED%/}${INSDESTTREE}/lib-python/2.7" + + # Generate Grammar and PatternGrammar pickles. + "${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \ + || die "Generation of Grammar and PatternGrammar pickles failed" + + # Generate cffi cache + "${PYTHON}" -c "import _curses" || die "Failed to import _curses" + if use sqlite; then + "${PYTHON}" -c "import _sqlite3" || die "Failed to import _sqlite3" + fi + + # compile the installed modules + python_optimize "${ED%/}${INSDESTTREE}" +} |