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

.. seealso::

--- 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

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'

newcc = None if 'CC' in os.environ: @@ -232,7 +232,7 @@ def customize_compiler(compiler): linker_exe=cc, archiver=archiver)

def get_config_h_filename(): @@ -487,6 +487,7 @@ def _init_nt(): g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['SO'] = '.pyd'

--- 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))

@@ -328,7 +328,7 @@ class BuildExtTestCase(TempdirManager, cmd.run() so_file = cmd.get_outputs()[0] self.assertTrue(os.path.exists(so_file))

@@ -355,7 +355,7 @@ class BuildExtTestCase(TempdirManager, self.assertEqual(lastdir, 'bar') def test_ext_fullpath(self):

--- 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'

--- 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

+ 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

--- 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':

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">&quot;</mi></mrow><annotation encoding="application/x-tex">as_echo &quot;</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">&quot;</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

-# -- 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 .VERSIONtrd.‘{ABIFLAGS} AC_MSG_RESULT($SOABI) +AC_SUBST(EXT_SUFFIX) +case $ac_sys_system in

-# -- 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

# 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.

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