Commit 156e8182 authored by doko@ubuntu.com's avatar doko@ubuntu.com

- 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.
parent 5bbae640
...@@ -667,10 +667,10 @@ class build_ext(Command): ...@@ -667,10 +667,10 @@ class build_ext(Command):
if os.name == "os2": if os.name == "os2":
ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8] ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
# extensions in debug_mode are named 'module_d.pyd' under windows # extensions in debug_mode are named 'module_d.pyd' under windows
so_ext = get_config_var('SO') ext_suffix = get_config_var('EXT_SUFFIX')
if os.name == 'nt' and self.debug: if os.name == 'nt' and self.debug:
return os.path.join(*ext_path) + '_d' + so_ext return os.path.join(*ext_path) + '_d' + ext_suffix
return os.path.join(*ext_path) + so_ext return os.path.join(*ext_path) + ext_suffix
def get_export_symbols(self, ext): def get_export_symbols(self, ext):
"""Return the list of symbols that a shared extension has to """Return the list of symbols that a shared extension has to
......
...@@ -170,9 +170,9 @@ def customize_compiler(compiler): ...@@ -170,9 +170,9 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars) _osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
newcc = None newcc = None
if 'CC' in os.environ: if 'CC' in os.environ:
...@@ -211,7 +211,7 @@ def customize_compiler(compiler): ...@@ -211,7 +211,7 @@ def customize_compiler(compiler):
linker_exe=cc, linker_exe=cc,
archiver=archiver) archiver=archiver)
compiler.shared_lib_extension = so_ext compiler.shared_lib_extension = shlib_suffix
def get_config_h_filename(): def get_config_h_filename():
...@@ -466,6 +466,7 @@ def _init_nt(): ...@@ -466,6 +466,7 @@ def _init_nt():
g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['INCLUDEPY'] = get_python_inc(plat_specific=0)
g['SO'] = '.pyd' g['SO'] = '.pyd'
g['EXT_SUFFIX'] = '.pyd'
g['EXE'] = ".exe" g['EXE'] = ".exe"
g['VERSION'] = get_python_version().replace(".", "") g['VERSION'] = get_python_version().replace(".", "")
g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable)) g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
...@@ -485,6 +486,7 @@ def _init_os2(): ...@@ -485,6 +486,7 @@ def _init_os2():
g['INCLUDEPY'] = get_python_inc(plat_specific=0) g['INCLUDEPY'] = get_python_inc(plat_specific=0)
g['SO'] = '.pyd' g['SO'] = '.pyd'
g['EXT_SUFFIX'] = '.pyd'
g['EXE'] = ".exe" g['EXE'] = ".exe"
global _config_vars global _config_vars
......
...@@ -318,8 +318,8 @@ class BuildExtTestCase(TempdirManager, ...@@ -318,8 +318,8 @@ class BuildExtTestCase(TempdirManager,
finally: finally:
os.chdir(old_wd) os.chdir(old_wd)
self.assertTrue(os.path.exists(so_file)) self.assertTrue(os.path.exists(so_file))
so_ext = sysconfig.get_config_var('SO') ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
self.assertTrue(so_file.endswith(so_ext)) self.assertTrue(so_file.endswith(ext_suffix))
so_dir = os.path.dirname(so_file) so_dir = os.path.dirname(so_file)
self.assertEqual(so_dir, other_tmp_dir) self.assertEqual(so_dir, other_tmp_dir)
...@@ -328,7 +328,7 @@ class BuildExtTestCase(TempdirManager, ...@@ -328,7 +328,7 @@ class BuildExtTestCase(TempdirManager,
cmd.run() cmd.run()
so_file = cmd.get_outputs()[0] so_file = cmd.get_outputs()[0]
self.assertTrue(os.path.exists(so_file)) self.assertTrue(os.path.exists(so_file))
self.assertTrue(so_file.endswith(so_ext)) self.assertTrue(so_file.endswith(ext_suffix))
so_dir = os.path.dirname(so_file) so_dir = os.path.dirname(so_file)
self.assertEqual(so_dir, cmd.build_lib) self.assertEqual(so_dir, cmd.build_lib)
...@@ -355,7 +355,7 @@ class BuildExtTestCase(TempdirManager, ...@@ -355,7 +355,7 @@ class BuildExtTestCase(TempdirManager,
self.assertEqual(lastdir, 'bar') self.assertEqual(lastdir, 'bar')
def test_ext_fullpath(self): def test_ext_fullpath(self):
ext = sysconfig.get_config_vars()['SO'] ext = sysconfig.get_config_var('EXT_SUFFIX')
# building lxml.etree inplace # building lxml.etree inplace
#etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') #etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
#etree_ext = Extension('lxml.etree', [etree_c]) #etree_ext = Extension('lxml.etree', [etree_c])
......
...@@ -23,7 +23,7 @@ from distutils.tests import support ...@@ -23,7 +23,7 @@ from distutils.tests import support
def _make_ext_name(modname): def _make_ext_name(modname):
if os.name == 'nt' and sys.executable.endswith('_d.exe'): if os.name == 'nt' and sys.executable.endswith('_d.exe'):
modname += '_d' modname += '_d'
return modname + sysconfig.get_config_var('SO') return modname + sysconfig.get_config_var('EXT_SUFFIX')
class InstallTestCase(support.TempdirManager, class InstallTestCase(support.TempdirManager,
......
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