[Python-checkins] cpython: Issue #22980: Under Linux, C extensions now include bitness in the file name,

antoine.pitrou python-checkins at python.org
Sun Mar 8 20:48:49 CET 2015


https://hg.python.org/cpython/rev/25356d34b79b
changeset:   94906:25356d34b79b
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Mar 08 20:43:10 2015 +0100
summary:
  Issue #22980: Under Linux, C extensions now include bitness in the file name,
to make it easy to test 32-bit and 64-bit builds in the same working tree.

files:
  Lib/test/test_sysconfig.py |   6 ++++++
  Misc/NEWS                  |   4 ++++
  configure                  |  10 +++++++++-
  configure.ac               |  10 +++++++++-
  4 files changed, 28 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -389,6 +389,12 @@
         self.assertIsNotNone(vars['SO'])
         self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
 
+    @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test')
+    def test_bitness_in_ext_suffix(self):
+        suffix = sysconfig.get_config_var('EXT_SUFFIX')
+        bitness = '-32b' if sys.maxsize < 2**32 else '-64b'
+        self.assertTrue(suffix.endswith(bitness + '.so'), suffix)
+
 
 class MakefileTests(unittest.TestCase):
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@
 Core and Builtins
 -----------------
 
+- Issue #22980: Under Linux, C extensions now include bitness in the file
+  name, to make it easy to test 32-bit and 64-bit builds in the same
+  working tree.
+
 - Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError
   if a function returns a result and raises an exception. The SystemError is
   chained to the previous exception.
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -14200,7 +14200,15 @@
 $as_echo "$ABIFLAGS" >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
 $as_echo_n "checking SOABI... " >&6; }
-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}
+
+case $ac_sys_system in
+    Linux*|GNU*)
+        BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;;
+    *)
+        BITNESS_SUFFIX=;;
+esac
+SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX}
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5
 $as_echo "$SOABI" >&6; }
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -4175,7 +4175,15 @@
 AC_MSG_CHECKING(ABIFLAGS)
 AC_MSG_RESULT($ABIFLAGS)
 AC_MSG_CHECKING(SOABI)
-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}
+
+case $ac_sys_system in
+    Linux*|GNU*)
+        BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;;
+    *)
+        BITNESS_SUFFIX=;;
+esac
+SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX}
+
 AC_MSG_RESULT($SOABI)
 
 AC_SUBST(EXT_SUFFIX)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list