[pypy-commit] pypy py3k: apply 722471a15693 from default
pjenvey
noreply at buildbot.pypy.org
Tue Jun 4 01:35:24 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r64741:43b233e93eed
Date: 2013-06-03 16:34 -0700
http://bitbucket.org/pypy/pypy/changeset/43b233e93eed/
Log: apply 722471a15693 from default
diff --git a/lib-python/3/distutils/command/build_ext.py b/lib-python/3/distutils/command/build_ext.py
--- a/lib-python/3/distutils/command/build_ext.py
+++ b/lib-python/3/distutils/command/build_ext.py
@@ -4,7 +4,7 @@
modules (currently limited to C extensions, should accommodate C++
extensions ASAP)."""
-import sys, os, re
+import sys, os, re, imp
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler, get_python_version
@@ -35,6 +35,11 @@
from distutils.ccompiler import show_compilers
show_compilers()
+def _get_c_extension_suffix():
+ for ext, mod, typ in imp.get_suffixes():
+ if typ == imp.C_EXTENSION:
+ return ext
+
class build_ext(Command):
@@ -671,10 +676,18 @@
# OS/2 has an 8 character module (extension) limit :-(
if os.name == "os2":
ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
+ # PyPy tweak: first try to get the C extension suffix from
+ # 'imp'. If it fails we fall back to the 'SO' config var, like
+ # the previous version of this code did. This should work for
+ # CPython too. The point is that on PyPy with cpyext, the
+ # config var 'SO' is just ".so" but we want to return
+ # ".pypy-VERSION.so" instead.
+ so_ext = _get_c_extension_suffix()
+ if so_ext is None:
+ so_ext = get_config_var('SO') # fall-back
# extensions in debug_mode are named 'module_d.pyd' under windows
- so_ext = get_config_var('SO')
if os.name == 'nt' and self.debug:
- return os.path.join(*ext_path) + '_d' + so_ext
+ so_ext = '_d.pyd'
return os.path.join(*ext_path) + so_ext
def get_export_symbols(self, ext):
diff --git a/lib-python/3/distutils/sysconfig_pypy.py b/lib-python/3/distutils/sysconfig_pypy.py
--- a/lib-python/3/distutils/sysconfig_pypy.py
+++ b/lib-python/3/distutils/sysconfig_pypy.py
@@ -1,9 +1,17 @@
-"""PyPy's minimal configuration information.
+"""Provide access to Python's configuration information.
+This is actually PyPy's minimal configuration information.
+
+The specific configuration variables available depend heavily on the
+platform and configuration. The values may be retrieved using
+get_config_var(name), and the list of variables is available via
+get_config_vars().keys(). Additional convenience functions are also
+available.
"""
+__revision__ = "$Id: sysconfig.py 85358 2010-10-10 09:54:59Z antoine.pitrou $"
+
import sys
import os
-import imp
from distutils.errors import DistutilsPlatformError
@@ -49,18 +57,14 @@
_config_vars = None
-def _get_so_extension():
- for ext, mod, typ in imp.get_suffixes():
- if typ == imp.C_EXTENSION:
- return ext
-
def _init_posix():
"""Initialize the module as appropriate for POSIX systems."""
g = {}
g['EXE'] = ""
- g['SO'] = _get_so_extension() or ".so"
+ g['SO'] = ".so"
g['SOABI'] = g['SO'].rsplit('.')[0]
g['LIBDIR'] = os.path.join(sys.prefix, 'lib')
+ g['CC'] = "gcc -pthread" # -pthread might not be valid on OS/X, check
global _config_vars
_config_vars = g
@@ -70,7 +74,7 @@
"""Initialize the module as appropriate for NT"""
g = {}
g['EXE'] = ".exe"
- g['SO'] = _get_so_extension() or ".pyd"
+ g['SO'] = ".pyd"
g['SOABI'] = g['SO'].rsplit('.')[0]
global _config_vars
More information about the pypy-commit
mailing list