Author: Armin Rigo <[email protected]>
Branch:
Changeset: r64698:722471a15693
Date: 2013-06-01 11:50 +0200
http://bitbucket.org/pypy/pypy/changeset/722471a15693/
Log: Attempt to fix issue #1506: change back the config var 'SO' to be
the regular so extension for that platforms (e.g. ".so"). Instead,
use the extended naming ".pypy-20.so" only in build_ext.
diff --git a/lib-python/2.7/distutils/command/build_ext.py
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -8,7 +8,7 @@
__revision__ = "$Id$"
-import sys, os, string, re
+import sys, os, string, re, imp
from types import *
from site import USER_BASE, USER_SITE
from distutils.core import Command
@@ -33,6 +33,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):
@@ -677,10 +682,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/2.7/distutils/sysconfig_pypy.py
b/lib-python/2.7/distutils/sysconfig_pypy.py
--- a/lib-python/2.7/distutils/sysconfig_pypy.py
+++ b/lib-python/2.7/distutils/sysconfig_pypy.py
@@ -12,7 +12,6 @@
import sys
import os
-import imp
from distutils.errors import DistutilsPlatformError
@@ -58,16 +57,11 @@
_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
@@ -80,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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit