=== modified file 'Lib/distutils/tests/test_build_ext.py' --- Lib/distutils/tests/test_build_ext.py 2010-04-02 21:38:52 +0000 +++ Lib/distutils/tests/test_build_ext.py 2010-07-09 21:22:41 +0000 @@ -330,8 +330,8 @@ finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file)) - self.assertEquals(os.path.splitext(so_file)[-1], - sysconfig.get_config_var('SO')) + so_ext = sysconfig.get_config_var('SO') + self.assertTrue(so_file.endswith(so_ext)) so_dir = os.path.dirname(so_file) self.assertEquals(so_dir, other_tmp_dir) @@ -339,8 +339,7 @@ cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file)) - self.assertEquals(os.path.splitext(so_file)[-1], - sysconfig.get_config_var('SO')) + self.assertTrue(so_file.endswith(so_ext)) so_dir = os.path.dirname(so_file) self.assertEquals(so_dir, cmd.build_lib) === modified file 'Makefile.pre.in' --- Makefile.pre.in 2010-07-09 15:30:58 +0000 +++ Makefile.pre.in 2010-07-12 14:33:19 +0000 @@ -35,6 +35,7 @@ AR= @AR@ RANLIB= @RANLIB@ SVNVERSION= @SVNVERSION@ +SOABI= @SOABI@ GNULD= @GNULD@ @@ -560,6 +561,11 @@ Modules/python.o: $(srcdir)/Modules/python.c $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c +Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile + $(CC) -c $(PY_CORE_CFLAGS) \ + $(SOABI) \ + -o $@ $(srcdir)/Python/dynload_shlib.c + $(IO_OBJS): $(IO_H) $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) === modified file 'Python/dynload_shlib.c' --- Python/dynload_shlib.c 2010-05-09 14:52:27 +0000 +++ Python/dynload_shlib.c 2010-07-09 21:51:23 +0000 @@ -30,27 +30,36 @@ #define LEAD_UNDERSCORE "" #endif +/* The .so extension module ABI tag, supplied by the Makefile via + Makefile.pre.in and configure. This is used to discriminate between + incompatible .so files so that extensions for different Python builds can + live in the same directory. E.g. foomodule.cpython-32.so +*/ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef __CYGWIN__ {".dll", "rb", C_EXTENSION}, {"module.dll", "rb", C_EXTENSION}, -#else +#else /* !__CYGWIN__ */ #if defined(PYOS_OS2) && defined(PYCC_GCC) {".pyd", "rb", C_EXTENSION}, {".dll", "rb", C_EXTENSION}, -#else +#else /* !(defined(PYOS_OS2) && defined(PYCC_GCC)) */ #ifdef __VMS {".exe", "rb", C_EXTENSION}, {".EXE", "rb", C_EXTENSION}, {"module.exe", "rb", C_EXTENSION}, {"MODULE.EXE", "rb", C_EXTENSION}, -#else +#else /* !__VMS */ +#ifdef SOABI + {"." SOABI ".so", "rb", C_EXTENSION}, + {"module." SOABI ".so", "rb", C_EXTENSION}, +#endif /* SOABI */ {".so", "rb", C_EXTENSION}, {"module.so", "rb", C_EXTENSION}, -#endif -#endif -#endif +#endif /* __VMS */ +#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ +#endif /* __CYGWIN__ */ {0, 0} }; === modified file 'configure' --- configure 2010-07-09 15:30:58 +0000 +++ configure 2010-07-12 14:26:41 +0000 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 82090 . +# From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65 for python 3.2. # @@ -679,6 +679,7 @@ ARCH_RUN_32BIT UNIVERSALSDK CONFIG_ARGS +SOABI SOVERSION VERSION target_alias @@ -722,6 +723,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking +with_so_abi_tag enable_universalsdk with_universal_archs with_framework_name @@ -1386,6 +1388,8 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-so-abi-tag=TAG specify a tag to uniquely identify .so file ABI + compliance; e.g. foo..so --with-universal-archs=ARCH select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all") @@ -2696,9 +2700,29 @@ VERSION=3.2 +# Version number or Python's own shared library file. SOVERSION=1.0 +# ABI version string for Python extension modules. This appears between the +# periods in shared library file names, e.g. foo..so. Use the empty +# string to specify no value. + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-so-abi-tag" >&5 +$as_echo_n "checking for --with-so-abi-tag... " >&6; } + +# Check whether --with-so-abi-tag was given. +if test "${with_so_abi_tag+set}" = set; then : + withval=$with_so_abi_tag; + SOABI=$withval +else + + SOABI= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 +$as_echo "$SOABI" >&6; } + # The later defininition of _XOPEN_SOURCE disables certain features # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). @@ -7424,6 +7448,16 @@ esac ;; CYGWIN*) SO=.dll;; + Linux*) + if test -z "$SOABI" + then + SO=.so + SOABI=-USOABI + else + SO=.${SOABI}.so + SOABI="-DSOABI=\\\"$SOABI\\\"" + fi + ;; *) SO=.so;; esac else === modified file 'configure.in' --- configure.in 2010-07-09 15:30:58 +0000 +++ configure.in 2010-07-12 14:23:03 +0000 @@ -52,9 +52,23 @@ AC_SUBST(VERSION) VERSION=PYTHON_VERSION +# Version number or Python's own shared library file. AC_SUBST(SOVERSION) SOVERSION=1.0 +# ABI version string for Python extension modules. This appears between the +# periods in shared library file names, e.g. foo..so. Use the empty +# string to specify no value. +AC_SUBST(SOABI) +AC_MSG_CHECKING(for --with-so-abi-tag) +AC_ARG_WITH(so-abi-tag, + AS_HELP_STRING([--with-so-abi-tag=TAG], + [specify a tag to uniquely identify .so file ABI compliance; e.g. foo..so]), +[ + SOABI=$withval], [ + SOABI= ]) +AC_MSG_RESULT($SOABI) + # The later defininition of _XOPEN_SOURCE disables certain features # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) @@ -1655,6 +1669,16 @@ esac ;; CYGWIN*) SO=.dll;; + Linux*) + if test -z "$SOABI" + then + SO=.so + SOABI=-USOABI + else + SO=.${SOABI}.so + SOABI="-DSOABI=\\\"$SOABI\\\"" + fi + ;; *) SO=.so;; esac else