mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fixed the "pre-link hook" so it actually works, mainly by renaming it
to 'msvc_prelink_hack()', adding the parameters that it actually needs, and only calling it for MSVC compiler objects. Generally gave up on the idea of a general "hook" mechanism: deleted the empty 'precompile_hook()'.
This commit is contained in:
parent
68ff615c79
commit
f46a688e84
1 changed files with 30 additions and 38 deletions
|
@ -188,7 +188,8 @@ class build_ext (Command):
|
||||||
|
|
||||||
# Setup the CCompiler object that we'll use to do all the
|
# Setup the CCompiler object that we'll use to do all the
|
||||||
# compiling and linking
|
# compiling and linking
|
||||||
self.compiler = new_compiler (compiler=self.compiler,
|
self.compiler = new_compiler (#compiler=self.compiler,
|
||||||
|
compiler="msvc",
|
||||||
verbose=self.verbose,
|
verbose=self.verbose,
|
||||||
dry_run=self.dry_run,
|
dry_run=self.dry_run,
|
||||||
force=self.force)
|
force=self.force)
|
||||||
|
@ -402,11 +403,6 @@ class build_ext (Command):
|
||||||
if os.environ.has_key('CFLAGS'):
|
if os.environ.has_key('CFLAGS'):
|
||||||
extra_args.extend(string.split(os.environ['CFLAGS']))
|
extra_args.extend(string.split(os.environ['CFLAGS']))
|
||||||
|
|
||||||
# Run any platform/compiler-specific hooks needed before
|
|
||||||
# compiling (currently none, but any hypothetical subclasses
|
|
||||||
# might find it useful to override this).
|
|
||||||
self.precompile_hook()
|
|
||||||
|
|
||||||
objects = self.compiler.compile (sources,
|
objects = self.compiler.compile (sources,
|
||||||
output_dir=self.build_temp,
|
output_dir=self.build_temp,
|
||||||
#macros=macros,
|
#macros=macros,
|
||||||
|
@ -421,9 +417,9 @@ class build_ext (Command):
|
||||||
objects.extend (ext.extra_objects)
|
objects.extend (ext.extra_objects)
|
||||||
extra_args = ext.extra_link_args
|
extra_args = ext.extra_link_args
|
||||||
|
|
||||||
# Run any platform/compiler-specific hooks needed between
|
# Bunch of fixing-up we have to do for Microsoft's linker.
|
||||||
# compiling and linking (currently needed only on Windows).
|
if self.compiler.compiler_type == 'msvc':
|
||||||
self.prelink_hook()
|
self.msvc_prelink_hack(sources, ext, extra_args)
|
||||||
|
|
||||||
self.compiler.link_shared_object (
|
self.compiler.link_shared_object (
|
||||||
objects, ext_filename,
|
objects, ext_filename,
|
||||||
|
@ -504,12 +500,9 @@ class build_ext (Command):
|
||||||
# find_swig ()
|
# find_swig ()
|
||||||
|
|
||||||
|
|
||||||
# -- Hooks ---------------------------------------------------------
|
# -- Hooks 'n hacks ------------------------------------------------
|
||||||
|
|
||||||
def precompile_hook (self):
|
def msvc_prelink_hack (self, sources, ext, extra_args):
|
||||||
pass
|
|
||||||
|
|
||||||
def prelink_hook (self):
|
|
||||||
|
|
||||||
# XXX this is a kludge! Knowledge of specific compilers or
|
# XXX this is a kludge! Knowledge of specific compilers or
|
||||||
# platforms really doesn't belong here; in an ideal world, the
|
# platforms really doesn't belong here; in an ideal world, the
|
||||||
|
@ -521,7 +514,7 @@ class build_ext (Command):
|
||||||
# Thus, kludges like this slip in occasionally. (This is no
|
# Thus, kludges like this slip in occasionally. (This is no
|
||||||
# excuse for committing more platform- and compiler-specific
|
# excuse for committing more platform- and compiler-specific
|
||||||
# kludges; they are to be avoided if possible!)
|
# kludges; they are to be avoided if possible!)
|
||||||
if self.compiler.compiler_type == 'msvc':
|
|
||||||
def_file = ext.export_symbol_file
|
def_file = ext.export_symbol_file
|
||||||
if def_file is None:
|
if def_file is None:
|
||||||
source_dir = os.path.dirname (sources[0])
|
source_dir = os.path.dirname (sources[0])
|
||||||
|
@ -545,9 +538,8 @@ class build_ext (Command):
|
||||||
self.get_ext_libname (ext.name))
|
self.get_ext_libname (ext.name))
|
||||||
extra_args.append ('/IMPLIB:' + implib_file)
|
extra_args.append ('/IMPLIB:' + implib_file)
|
||||||
self.mkpath (os.path.dirname (implib_file))
|
self.mkpath (os.path.dirname (implib_file))
|
||||||
# if MSVC
|
|
||||||
|
|
||||||
# prelink_hook ()
|
# msvc_prelink_hack ()
|
||||||
|
|
||||||
|
|
||||||
# -- Name generators -----------------------------------------------
|
# -- Name generators -----------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue