Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r64708:a674c4a68284
Date: 2013-06-02 10:21 +0200
http://bitbucket.org/pypy/pypy/changeset/a674c4a68284/

Log:    Fix _testcapi and _test_ctypes after 722471a15693, sorry.

diff --git a/lib_pypy/_ctypes_test.py b/lib_pypy/_ctypes_test.py
--- a/lib_pypy/_ctypes_test.py
+++ b/lib_pypy/_ctypes_test.py
@@ -1,6 +1,12 @@
-import os, sys
+import os, sys, imp
 import tempfile
 
+def _get_c_extension_suffix():
+    for ext, mod, typ in imp.get_suffixes():
+        if typ == imp.C_EXTENSION:
+            return ext
+
+
 def compile_shared():
     """Compile '_ctypes_test.c' into an extension module, and import it
     """
@@ -8,7 +14,6 @@
     output_dir = tempfile.mkdtemp()
 
     from distutils.ccompiler import new_compiler
-    from distutils import sysconfig
 
     compiler = new_compiler()
     compiler.output_dir = output_dir
@@ -25,7 +30,7 @@
     object_filename = res[0]
 
     # set link options
-    output_filename = '_ctypes_test' + sysconfig.get_config_var('SO')
+    output_filename = '_ctypes_test' + _get_c_extension_suffix()
     if sys.platform == 'win32':
         # XXX libpypy-c.lib is currently not installed automatically
         library = os.path.join(thisdir, '..', 'include', 'libpypy-c')
diff --git a/lib_pypy/_testcapi.py b/lib_pypy/_testcapi.py
--- a/lib_pypy/_testcapi.py
+++ b/lib_pypy/_testcapi.py
@@ -1,6 +1,12 @@
-import os, sys
+import os, sys, imp
 import tempfile
 
+def _get_c_extension_suffix():
+    for ext, mod, typ in imp.get_suffixes():
+        if typ == imp.C_EXTENSION:
+            return ext
+
+
 def compile_shared():
     """Compile '_testcapi.c' into an extension module, and import it
     """
@@ -8,7 +14,6 @@
     output_dir = tempfile.mkdtemp()
 
     from distutils.ccompiler import new_compiler
-    from distutils import sysconfig
 
     compiler = new_compiler()
     compiler.output_dir = output_dir
@@ -25,7 +30,7 @@
     object_filename = res[0]
 
     # set link options
-    output_filename = '_testcapi' + sysconfig.get_config_var('SO')
+    output_filename = '_testcapi' + _get_c_extension_suffix()
     if sys.platform == 'win32':
         # XXX libpypy-c.lib is currently not installed automatically
         library = os.path.join(thisdir, '..', 'include', 'libpypy-c')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to