cpython: 14f0c9e595a5 (original) (raw)
Mercurial > cpython
changeset 82870:14f0c9e595a5 3.3
- Issue #16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. [#16754]
doko@ubuntu.com | |
---|---|
date | Thu, 21 Mar 2013 13:31:41 -0700 |
parents | d98a515489db(current diff)8f91014c8f00(diff) |
children | f6a6b4eed5b0 5540ed8c9824 |
files | Doc/whatsnew/3.2.rst Lib/distutils/command/build_ext.py Lib/distutils/sysconfig.py Lib/distutils/tests/test_build_ext.py Lib/sysconfig.py Makefile.pre.in Misc/NEWS Misc/python-config.in configure configure.ac pyconfig.h.in setup.py |
diffstat | 12 files changed, 89 insertions(+), 99 deletions(-)[+] [-] Doc/whatsnew/3.2.rst 4 Lib/distutils/command/build_ext.py 6 Lib/distutils/sysconfig.py 8 Lib/distutils/tests/test_build_ext.py 8 Lib/distutils/tests/test_install.py 2 Lib/sysconfig.py 1 Makefile.pre.in 11 Misc/NEWS 4 Misc/python-config.in 2 configure 69 configure.ac 60 setup.py 13 |
line wrap: on
line diff
--- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -368,9 +368,9 @@ In Python itself, the tags are accessibl module:: >>> import sysconfig
--- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -677,10 +677,10 @@ class build_ext(Command): if os.name == "os2": ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8] # extensions in debug_mode are named 'module_d.pyd' under windows
so_ext = get_config_var('SO')[](#l2.7)
ext_suffix = get_config_var('EXT_SUFFIX')[](#l2.8) if os.name == 'nt' and self.debug:[](#l2.9)
return os.path.join(*ext_path) + '_d' + so_ext[](#l2.10)
return os.path.join(*ext_path) + so_ext[](#l2.11)
return os.path.join(*ext_path) + '_d' + ext_suffix[](#l2.12)
return os.path.join(*ext_path) + ext_suffix[](#l2.13)
def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to
--- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -191,9 +191,9 @@ def customize_compiler(compiler): _osx_support.customize_compiler(_config_vars) _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \[](#l3.7)
(cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \[](#l3.8) get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',[](#l3.9)
'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS')[](#l3.10)
'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')[](#l3.11)
newcc = None if 'CC' in os.environ: @@ -232,7 +232,7 @@ def customize_compiler(compiler): linker_exe=cc, archiver=archiver)
compiler.shared_lib_extension = so_ext[](#l3.19)
compiler.shared_lib_extension = shlib_suffix[](#l3.20)
def get_config_h_filename(): @@ -487,6 +487,7 @@ def _init_nt(): g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd'
- g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" g['VERSION'] = get_python_version().replace(".", "") g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) @@ -506,6 +507,7 @@ def _init_os2(): g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd'
- g['EXT_SUFFIX'] = '.pyd' g['EXE'] = ".exe" global _config_vars
--- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -318,8 +318,8 @@ class BuildExtTestCase(TempdirManager, finally: os.chdir(old_wd) self.assertTrue(os.path.exists(so_file))
so_ext = sysconfig.get_config_var('SO')[](#l4.7)
self.assertTrue(so_file.endswith(so_ext))[](#l4.8)
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')[](#l4.9)
self.assertTrue(so_file.endswith(ext_suffix))[](#l4.10) so_dir = os.path.dirname(so_file)[](#l4.11) self.assertEqual(so_dir, other_tmp_dir)[](#l4.12)
@@ -328,7 +328,7 @@ class BuildExtTestCase(TempdirManager, cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file))
self.assertTrue(so_file.endswith(so_ext))[](#l4.18)
self.assertTrue(so_file.endswith(ext_suffix))[](#l4.19) so_dir = os.path.dirname(so_file)[](#l4.20) self.assertEqual(so_dir, cmd.build_lib)[](#l4.21)
@@ -355,7 +355,7 @@ class BuildExtTestCase(TempdirManager, self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self):
ext = sysconfig.get_config_vars()['SO'][](#l4.27)
ext = sysconfig.get_config_var('EXT_SUFFIX')[](#l4.28) # building lxml.etree inplace[](#l4.29) #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')[](#l4.30) #etree_ext = Extension('lxml.etree', [etree_c])[](#l4.31)
--- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -23,7 +23,7 @@ from distutils.tests import support def _make_ext_name(modname): if os.name == 'nt' and sys.executable.endswith('_d.exe'): modname += '_d'
class InstallTestCase(support.TempdirManager,
--- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -437,6 +437,7 @@ def _init_non_posix(vars): vars['BINLIBDEST'] = get_path('platstdlib') vars['INCLUDEPY'] = get_path('include') vars['SO'] = '.pyd'
- vars['EXT_SUFFIX'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
--- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -125,7 +125,9 @@ INCLUDEPY= (INCLUDEDIR)/python(INCLUDEDIR)/python(INCLUDEDIR)/python(LDVERSI CONFINCLUDEPY= (CONFINCLUDEDIR)/python(CONFINCLUDEDIR)/python(CONFINCLUDEDIR)/python(LDVERSION)
Symbols used for using shared libraries
-SO= @SO@ +SHLIB_SUFFIX= @SHLIB_SUFFIX@ +EXT_SUFFIX= @EXT_SUFFIX@ +SO= $(SHLIB_SUFFIX) LDSHARED= @LDSHARED@ $(PY_LDFLAGS) BLDSHARED= @BLDSHARED@ $(PY_LDFLAGS) LDCXXSHARED= @LDCXXSHARED@ @@ -652,6 +654,11 @@ Python/dynload_shlib.o: $(srcdir)/Python -DSOABI='"$(SOABI)"' [](#l7.15) -o @@ @(srcdir)/Python/dynload_shlib.c +Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile
- (CC)−c(CC) -c (CC)−c(PY_CORE_CFLAGS) [](#l7.19)
-DSHLIB_EXT='"$(EXT_SUFFIX)"' \[](#l7.20)
-o <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">@</mi></mrow><annotation encoding="application/x-tex">@ </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord">@</span></span></span></span>(srcdir)/Python/dynload_hpux.c[](#l7.21)
+ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile (CC)−c(CC) -c (CC)−c(PY_CORE_CFLAGS) [](#l7.24) -DABIFLAGS='"$(ABIFLAGS)"' [](#l7.25) @@ -1186,7 +1193,7 @@ libainstall: all python-config done @if test -d $(LIBRARY); then :; else [](#l7.28) if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then [](#l7.29) - if test "$(SO)" = .dll; then [](#l7.30) + if test "$(SHLIB_SUFFIX)" = .dll; then [](#l7.31) (INSTALLDATA)(INSTALL_DATA) (INSTALLDATA)(LDLIBRARY) (DESTDIR)(DESTDIR)(DESTDIR)(LIBPL) ; [](#l7.32) else [](#l7.33) (INSTALLDATA)(INSTALL_DATA) (INSTALLDATA)(LIBRARY) (DESTDIR)(DESTDIR)(DESTDIR)(LIBPL)/$(LIBRARY) ; [](#l7.34)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -794,6 +794,10 @@ Tests Build ----- +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce
- two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of
- SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. +
- Issue #5033: Fix building of the sqlite3 extension module when the SQLite library version has "beta" in it. Patch by Andreas Pelme.
--- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -57,7 +57,7 @@ for opt in opt_flags: print(' '.join(libs)) elif opt == '--extension-suffix':
print(sysconfig.get_config_var('SO'))[](#l9.7)
print(sysconfig.get_config_var('EXT_SUFFIX'))[](#l9.8)
elif opt == '--abiflags': print(sys.abiflags)
--- a/configure
+++ b/configure
@@ -625,6 +625,7 @@ ac_includes_default="[](#l10.3)
ac_subst_vars='LTLIBOBJS
SRCDIRS
THREADHEADERS
+EXT_SUFFIX
SOABI
LIBC
LIBM
@@ -652,7 +653,7 @@ CCSHARED
BLDSHARED
LDCXXSHARED
LDSHARED
-SO
+SHLIB_SUFFIX
LIBTOOL_CRUFT
OTHER_LIBTOOL_OPT
UNIVERSAL_ARCH_FLAGS
@@ -8392,6 +8393,25 @@ esac
+# SHLIB_SUFFIX is the extension of shared libraries (including the dot!)[](#l10.24) +# -- usually .so, .sl on HP-UX, .dll on Cygwin[](#l10.25) +{ <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi><msub><mi>s</mi><mi>e</mi></msub><mi>c</mi><mi>h</mi><mi>o</mi><mi mathvariant="normal">"</mi></mrow><annotation encoding="application/x-tex">as_echo "</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8444em;vertical-align:-0.15em;"></span><span class="mord mathnormal">a</span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">e</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">c</span><span class="mord mathnormal">h</span><span class="mord mathnormal">o</span><span class="mord">"</span></span></span></span>as_me:${as_lineno-$LINENO}: checking the extension of shared libraries" >&5[](#l10.26) +$as_echo_n "checking the extension of shared libraries... " >&6; }[](#l10.27) +if test -z "$SHLIB_SUFFIX"; then[](#l10.28) + case $ac_sys_system in[](#l10.29) + hp*|HP*)[](#l10.30) + case
uname -m` in
+ ia64) SHLIB_SUFFIX=.so;;
+ ) SHLIB_SUFFIX=.sl;;
+ esac
+ ;;
+ CYGWIN) SHLIB_SUFFIX=.dll;;
+ *) SHLIB_SUFFIX=.so;;
+ esac
+fi
+{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $SHLIB_SUFFIX" >&5
+$as_echo "$SHLIB_SUFFIX" >&6; }
+
LDSHARED is the ld command used to create shared library
-- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
(Shared libraries in this instance are shared modules to be loaded into
@@ -13685,51 +13705,20 @@ SOABI='cpython-'`echo $VERSION | tr -d . { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 asecho"as_echo "asecho"SOABI" >&6; } + +case $ac_sys_system in
- Linux*|GNU*)
- EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
- *)
- EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking LDVERSION" >&5 $as_echo_n "checking LDVERSION... " >&6; } LDVERSION='$(VERSION)$(ABIFLAGS)' { asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $LDVERSION" >&5 asecho"as_echo "asecho"LDVERSION" >&6; } -# SO is the extension of shared libraries `(including the dot!)
-# -- usually .so, .sl on HP-UX, .dll on Cygwin
-{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking SO" >&5
-$as_echo_n "checking SO... " >&6; }
-if test -z "$SO"
-then
- case $ac_sys_system in
- hp*|HP*)
- case uname -m
in
- ia64) SO=.so;;
- ) SO=.sl;;
- esac
- ;;
- CYGWIN) SO=.dll;;
- Linux*|GNU*)
- SO=.${SOABI}.so;;
- *) SO=.so;;
- esac
-else
- # this might also be a termcap variable, see #610332
- echo
- echo '====================================================================='
- echo '+ +'
- echo '+ WARNING: You have set SO in your environment. +'
- echo '+ Do you really mean to change the extension for shared libraries? +'
- echo '+ Continuing in 10 seconds to let you to ponder. +'
- echo '+ +'
- echo '====================================================================='
- sleep 10
-fi
-{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $SO" >&5
-$as_echo "$SO" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define SHLIB_EXT "$SO"
-_ACEOF
-
-
Check whether right shifting a negative integer extends the sign bit
or fills with zeros (like the Cray J90, according to Tim Peters).
{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5
--- a/configure.ac +++ b/configure.ac @@ -1896,13 +1896,30 @@ case acsyssystem/ac_sys_system/acsyssystem/ac_sys_release in esac
Set info about shared libraries.
-AC_SUBST(SO)
+AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(LDSHARED)
AC_SUBST(LDCXXSHARED)
AC_SUBST(BLDSHARED)
AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED)
+# SHLIB_SUFFIX is the extension of shared libraries (including the dot!)[](#l11.15) +# -- usually .so, .sl on HP-UX, .dll on Cygwin[](#l11.16) +AC_MSG_CHECKING(the extension of shared libraries)[](#l11.17) +if test -z "$SHLIB_SUFFIX"; then[](#l11.18) + case $ac_sys_system in[](#l11.19) + hp*|HP*)[](#l11.20) + case
uname -m` in
+ ia64) SHLIB_SUFFIX=.so;;
+ ) SHLIB_SUFFIX=.sl;;
+ esac
+ ;;
+ CYGWIN) SHLIB_SUFFIX=.dll;;
+ *) SHLIB_SUFFIX=.so;;
+ esac
+fi
+AC_MSG_RESULT($SHLIB_SUFFIX)
+
LDSHARED is the ld command used to create shared library
-- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
(Shared libraries in this instance are shared modules to be loaded into
@@ -3925,43 +3942,18 @@ AC_MSG_CHECKING(SOABI)
SOABI='cpython-'echo <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>V</mi><mi>E</mi><mi>R</mi><mi>S</mi><mi>I</mi><mi>O</mi><mi>N</mi><mi mathvariant="normal">∣</mi><mi>t</mi><mi>r</mi><mo>−</mo><mi>d</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">‘</mi></mrow><annotation encoding="application/x-tex">VERSION | tr -d .
VERSION∣tr−d.‘{ABIFLAGS}
AC_MSG_RESULT($SOABI)
+AC_SUBST(EXT_SUFFIX)
+case $ac_sys_system in
- Linux*|GNU*)
- EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
- *)
- EXT_SUFFIX=${SHLIB_SUFFIX};; +esac + AC_MSG_CHECKING(LDVERSION) LDVERSION='$(VERSION)$(ABIFLAGS)' AC_MSG_RESULT($LDVERSION) -# SO is the extension of shared libraries `(including the dot!)
-# -- usually .so, .sl on HP-UX, .dll on Cygwin
-AC_MSG_CHECKING(SO)
-if test -z "$SO"
-then
- case $ac_sys_system in
- hp*|HP*)
- case uname -m
in
- ia64) SO=.so;;
- ) SO=.sl;;
- esac
- ;;
- CYGWIN) SO=.dll;;
- Linux*|GNU*)
- SO=.${SOABI}.so;;
- *) SO=.so;;
- esac
-else
- # this might also be a termcap variable, see #610332
- echo
- echo '====================================================================='
- echo '+ +'
- echo '+ WARNING: You have set SO in your environment. +'
- echo '+ Do you really mean to change the extension for shared libraries? +'
- echo '+ Continuing in 10 seconds to let you to ponder. +'
- echo '+ +'
- echo '====================================================================='
- sleep 10
-fi
-AC_MSG_RESULT($SO)
-
-AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
-
Check whether right shifting a negative integer extends the sign bit
or fills with zeros (like the Cray J90, according to Tim Peters).
AC_MSG_CHECKING(whether right shift extends the sign bit)
--- a/setup.py +++ b/setup.py @@ -169,13 +169,7 @@ class PyBuildExt(build_ext): def build_extensions(self): # Detect which modules should be compiled
old_so = self.compiler.shared_lib_extension[](#l13.7)
# Workaround PEP 3149 stuff[](#l13.8)
self.compiler.shared_lib_extension = os.environ.get("SO", ".so")[](#l13.9)
try:[](#l13.10)
missing = self.detect_modules()[](#l13.11)
finally:[](#l13.12)
self.compiler.shared_lib_extension = old_so[](#l13.13)
missing = self.detect_modules()[](#l13.14)
# Remove modules that are present on the disabled list extensions = [ext for ext in self.extensions @@ -2055,7 +2049,8 @@ class PyBuildInstallLib(install_lib): # mode 644 unless they are a shared library in which case they will get # mode 755. All installed directories will get mode 755.
this is works for EXT_SUFFIX too, which ends with SHLIB_SUFFIX
- shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX")
def install(self): outfiles = install_lib.install(self) @@ -2070,7 +2065,7 @@ class PyBuildInstallLib(install_lib): for filename in files: if os.path.islink(filename): continue mode = defaultMode
if filename.endswith(self.so_ext): mode = sharedLibMode[](#l13.32)
if filename.endswith(self.shlib_suffix): mode = sharedLibMode[](#l13.33) log.info("changing mode of %s to %o", filename, mode)[](#l13.34) if not self.dry_run: os.chmod(filename, mode)[](#l13.35)