Author: Stefan Beyer <h...@sbeyer.at>
Branch: py3.5
Changeset: r90478:215564273ab3
Date: 2017-03-02 12:54 +0100
http://bitbucket.org/pypy/pypy/changeset/215564273ab3/

Log:    Added EXT_SUFFIX for sysconfig, changed EXT_SUFFIX to Python 3
        format

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
@@ -60,8 +60,8 @@
 
 def _init_posix():
     """Initialize the module as appropriate for POSIX systems."""
-    so_list = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION]
-    so_ext = (so_list or ['.so'])[0]
+    so_ext = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
+
     g = {}
     g['CC'] = "gcc -pthread"
     g['CXX'] = "g++ -pthread"
@@ -69,8 +69,9 @@
     g['CFLAGS'] = "-DNDEBUG -O2"
     g['CCSHARED'] = "-fPIC"
     g['LDSHARED'] = "gcc -pthread -shared"
-    g['SO'] = so_ext
-    g['SHLIB_SUFFIX'] = g['SO']
+    g['EXT_SUFFIX'] = so_ext
+    g['SHLIB_SUFFIX'] = so_ext
+    g['SO'] = so_ext  # deprecated in Python 3, for backward compatibility
     g['AR'] = "ar"
     g['ARFLAGS'] = "rc"
     g['EXE'] = ""
diff --git a/lib_pypy/_sysconfigdata.py b/lib_pypy/_sysconfigdata.py
--- a/lib_pypy/_sysconfigdata.py
+++ b/lib_pypy/_sysconfigdata.py
@@ -1,5 +1,9 @@
 import imp
 
+so_ext = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
+
 build_time_vars = {
-    "SO": [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
+    "EXT_SUFFIX": so_ext,
+    "SHLIB_SUFFIX": so_ext,
+    "SO": so_ext  # deprecated in Python 3, for backward compatibility
 }
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -2,7 +2,7 @@
 Implementation of the interpreter-level default import logic.
 """
 
-import sys, os, stat
+import sys, os, stat, platform
 
 from pypy.interpreter.module import Module, init_extra_module_attrs
 from pypy.interpreter.gateway import interp2app, unwrap_spec
@@ -22,7 +22,7 @@
 
 SO = '.pyd' if _WIN32 else '.so'
 PREFIX = 'pypy3-'
-DEFAULT_SOABI = '%s%d%d' % ((PREFIX,) + PYPY_VERSION[:2])
+DEFAULT_SOABI_BASE = '%s%d%d' % ((PREFIX,) + PYPY_VERSION[:2])
 
 PYC_TAG = '%s%d%d' % ((PREFIX,) + PYPY_VERSION[:2])   # 'pypy3-XY'
 
@@ -35,7 +35,7 @@
     if space.config.objspace.soabi is not None:
         soabi = space.config.objspace.soabi
     else:
-        soabi = DEFAULT_SOABI
+        soabi = DEFAULT_SOABI_BASE
 
     if not soabi:
         return SO
@@ -43,6 +43,17 @@
     if not space.config.translating:
         soabi += 'i'
 
+    platform_name = sys.platform
+    if platform_name == 'linux2':
+        platform_name = 'linux'
+
+    soabi += '-' + platform.machine() + '-' + platform_name
+
+    if platform_name == 'linux':
+        soabi += '-gnu'
+        if sys.maxsize == (2**31 - 1) and platform.machine() == 'x86_64':
+            soabi += 'x32'
+
     return '.' + soabi + SO
 
 def log_pyverbose(space, level, message):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to