Kaydet (Commit) d3899c1a authored tarafından doko@ubuntu.com's avatar doko@ubuntu.com

- 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.
üst 7a80389c
......@@ -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):
......
......@@ -10,6 +10,10 @@ Release date: XXX
Core and Builtins
-----------------
- 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.
- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES.
Patch courtesy of Joe Jevnik.
......@@ -382,10 +386,6 @@ Release date: 2015-03-09
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.
......
This diff is collapsed.
......@@ -425,7 +425,7 @@ if test "$cross_compiling" = yes; then
esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
# disable features if it is defined, without any means to access these
# features as extensions. For these systems, we skip the definition of
......@@ -667,6 +667,8 @@ then
fi
fi
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GREP
AC_SUBST(CXX)
AC_SUBST(MAINCC)
......@@ -724,6 +726,132 @@ then
fi
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
AC_SUBST(MULTIARCH)
AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
cat >> conftest.c <<EOF
#undef linux
#undef i386
#undef unix
#if defined(__linux__)
# if defined(__x86_64__) && defined(__LP64__)
x86_64-linux-gnu
# elif defined(__x86_64__) && defined(__ILP32__)
x86_64-linux-gnux32
# elif defined(__i386__)
i386-linux-gnu
# elif defined(__aarch64__) && defined(__AARCH64EL__)
# if defined(__ILP32__)
aarch64_ilp32-linux-gnu
# else
aarch64-linux-gnu
# endif
# elif defined(__aarch64__) && defined(__AARCH64EB__)
# if defined(__ILP32__)
aarch64_be_ilp32-linux-gnu
# else
aarch64_be-linux-gnu
# endif
# elif defined(__alpha__)
alpha-linux-gnu
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
# if defined(__ARMEL__)
arm-linux-gnueabihf
# else
armeb-linux-gnueabihf
# endif
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
# if defined(__ARMEL__)
arm-linux-gnueabi
# else
armeb-linux-gnueabi
# endif
# elif defined(__hppa__)
hppa-linux-gnu
# elif defined(__ia64__)
ia64-linux-gnu
# elif defined(__m68k__) && !defined(__mcoldfire__)
m68k-linux-gnu
# elif defined(__mips_hard_float) && defined(_MIPSEL)
# if _MIPS_SIM == _ABIO32
mipsel-linux-gnu
# elif _MIPS_SIM == _ABIN32
mips64el-linux-gnuabin32
# elif _MIPS_SIM == _ABI64
mips64el-linux-gnuabi64
# else
# error unknown platform triplet
# endif
# elif defined(__mips_hard_float)
# if _MIPS_SIM == _ABIO32
mips-linux-gnu
# elif _MIPS_SIM == _ABIN32
mips64-linux-gnuabin32
# elif _MIPS_SIM == _ABI64
mips64-linux-gnuabi64
# else
# error unknown platform triplet
# endif
# elif defined(__or1k__)
or1k-linux-gnu
# elif defined(__powerpc__) && defined(__SPE__)
powerpc-linux-gnuspe
# elif defined(__powerpc64__)
# if defined(__LITTLE_ENDIAN__)
powerpc64le-linux-gnu
# else
powerpc64-linux-gnu
# endif
# elif defined(__powerpc__)
powerpc-linux-gnu
# elif defined(__s390x__)
s390x-linux-gnu
# elif defined(__s390__)
s390-linux-gnu
# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
sh4-linux-gnu
# elif defined(__sparc__) && defined(__arch64__)
sparc64-linux-gnu
# elif defined(__sparc__)
sparc-linux-gnu
# else
# error unknown platform triplet
# endif
#elif defined(__FreeBSD_kernel__)
# if defined(__LP64__)
x86_64-kfreebsd-gnu
# elif defined(__i386__)
i386-kfreebsd-gnu
# else
# error unknown platform triplet
# endif
#elif defined(__gnu_hurd__)
i386-gnu
#else
# error unknown platform triplet
#endif
EOF
if $CPP conftest.c >conftest.out 2>/dev/null; then
PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
AC_MSG_RESULT([$PLATFORM_TRIPLET])
else
AC_MSG_RESULT([none])
fi
rm -f conftest.c conftest.out
if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
fi
fi
PLATDIR=plat-$MACHDEP
AC_SUBST(PLATDIR)
AC_SUBST(PLATFORM_TRIPLET)
AC_MSG_CHECKING([for -Wl,--no-as-needed])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
......@@ -791,10 +919,6 @@ hp*|HP*)
esac;;
esac
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
AC_SUBST(MULTIARCH)
AC_SUBST(LIBRARY)
AC_MSG_CHECKING(LIBRARY)
if test -z "$LIBRARY"
......@@ -4183,15 +4307,7 @@ AC_SUBST(SOABI)
AC_MSG_CHECKING(ABIFLAGS)
AC_MSG_RESULT($ABIFLAGS)
AC_MSG_CHECKING(SOABI)
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}
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
AC_MSG_RESULT($SOABI)
AC_SUBST(EXT_SUFFIX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment