- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include

the architecture triplet in the extension name, to make it easy to test builds
  for different ABIs in the same working tree.
This commit is contained in:
doko@ubuntu.com 2015-04-15 20:23:14 +02:00
parent 7a80389ce5
commit d3899c1a96
4 changed files with 517 additions and 274 deletions

View file

@ -390,10 +390,19 @@ class TestSysConfig(unittest.TestCase):
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
@unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test')
def test_bitness_in_ext_suffix(self):
def test_triplet_in_ext_suffix(self):
import ctypes, platform, re
machine = platform.machine()
suffix = sysconfig.get_config_var('EXT_SUFFIX')
bitness = '-32b' if sys.maxsize < 2**32 else '-64b'
self.assertTrue(suffix.endswith(bitness + '.so'), suffix)
if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine):
self.assertTrue('linux' in suffix, suffix)
if re.match('(i[3-6]86|x86_64)$', 'x86_64'):
if ctypes.sizeof(ctypes.c_char_p()) == 4:
self.assertTrue(suffix.endswith('i386-linux-gnu.so') \
or suffix.endswith('x86_64-linux-gnux32.so'),
suffix)
else: # 8 byte pointer size
self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix)
class MakefileTests(unittest.TestCase):