Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(159032)

Side by Side Diff: Lib/distutils/command/build_ext.py

Issue 16754: Incorrect shared library extension on linux
Patch Set: Created 6 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « configure.ac ('k') | Lib/distutils/sysconfig.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """distutils.command.build_ext 1 """distutils.command.build_ext
2 2
3 Implements the Distutils 'build_ext' command, for building extension 3 Implements the Distutils 'build_ext' command, for building extension
4 modules (currently limited to C extensions, should accommodate C++ 4 modules (currently limited to C extensions, should accommodate C++
5 extensions ASAP).""" 5 extensions ASAP)."""
6 6
7 import sys, os, re 7 import sys, os, re
8 from distutils.core import Command 8 from distutils.core import Command
9 from distutils.errors import * 9 from distutils.errors import *
10 from distutils.sysconfig import customize_compiler, get_python_version 10 from distutils.sysconfig import customize_compiler, get_python_version
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 return self.package + '.' + ext_name 659 return self.package + '.' + ext_name
660 660
661 def get_ext_filename(self, ext_name): 661 def get_ext_filename(self, ext_name):
662 r"""Convert the name of an extension (eg. "foo.bar") into the name 662 r"""Convert the name of an extension (eg. "foo.bar") into the name
663 of the file from which it will be loaded (eg. "foo/bar.so", or 663 of the file from which it will be loaded (eg. "foo/bar.so", or
664 "foo\bar.pyd"). 664 "foo\bar.pyd").
665 """ 665 """
666 from distutils.sysconfig import get_config_var 666 from distutils.sysconfig import get_config_var
667 ext_path = ext_name.split('.') 667 ext_path = ext_name.split('.')
668 # extensions in debug_mode are named 'module_d.pyd' under windows 668 # extensions in debug_mode are named 'module_d.pyd' under windows
669 so_ext = get_config_var('SO') 669 ext_suffix = get_config_var('EXT_SUFFIX')
670 if os.name == 'nt' and self.debug: 670 if os.name == 'nt' and self.debug:
671 return os.path.join(*ext_path) + '_d' + so_ext 671 return os.path.join(*ext_path) + '_d' + ext_suffix
672 return os.path.join(*ext_path) + so_ext 672 return os.path.join(*ext_path) + ext_suffix
673 673
674 def get_export_symbols(self, ext): 674 def get_export_symbols(self, ext):
675 """Return the list of symbols that a shared extension has to 675 """Return the list of symbols that a shared extension has to
676 export. This either uses 'ext.export_symbols' or, if it's not 676 export. This either uses 'ext.export_symbols' or, if it's not
677 provided, "PyInit_" + module_name. Only relevant on Windows, where 677 provided, "PyInit_" + module_name. Only relevant on Windows, where
678 the .pyd file (DLL) must export the module "PyInit_" function. 678 the .pyd file (DLL) must export the module "PyInit_" function.
679 """ 679 """
680 initfunc_name = "PyInit_" + ext.name.split('.')[-1] 680 initfunc_name = "PyInit_" + ext.name.split('.')[-1]
681 if initfunc_name not in ext.export_symbols: 681 if initfunc_name not in ext.export_symbols:
682 ext.export_symbols.append(initfunc_name) 682 ext.export_symbols.append(initfunc_name)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 return ext.libraries 736 return ext.libraries
737 else: 737 else:
738 from distutils import sysconfig 738 from distutils import sysconfig
739 if sysconfig.get_config_var('Py_ENABLE_SHARED'): 739 if sysconfig.get_config_var('Py_ENABLE_SHARED'):
740 pythonlib = 'python{}.{}{}'.format( 740 pythonlib = 'python{}.{}{}'.format(
741 sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, 741 sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff,
742 sys.abiflags) 742 sys.abiflags)
743 return ext.libraries + [pythonlib] 743 return ext.libraries + [pythonlib]
744 else: 744 else:
745 return ext.libraries 745 return ext.libraries
OLDNEW
« no previous file with comments | « configure.ac ('k') | Lib/distutils/sysconfig.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+