[Python-checkins] CVS: distutils/distutils/command build_ext.py,1.46,1.47

Greg Ward python-dev@python.org
2000年6月24日 19:23:13 -0700


Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15662
Modified Files:
	build_ext.py 
Log Message:
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()'.
Index: build_ext.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/build_ext.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** build_ext.py	2000年06月25日 02:10:46	1.46
--- build_ext.py	2000年06月25日 02:23:11	1.47
***************
*** 189,193 ****
 # Setup the CCompiler object that we'll use to do all the
 # compiling and linking
! self.compiler = new_compiler (compiler=self.compiler,
 verbose=self.verbose,
 dry_run=self.dry_run,
--- 189,194 ----
 # Setup the CCompiler object that we'll use to do all the
 # compiling and linking
! self.compiler = new_compiler (#compiler=self.compiler,
! compiler="msvc",
 verbose=self.verbose,
 dry_run=self.dry_run,
***************
*** 403,411 ****
 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,
 output_dir=self.build_temp,
--- 404,407 ----
***************
*** 422,428 ****
 extra_args = ext.extra_link_args
 
! # Run any platform/compiler-specific hooks needed between
! # compiling and linking (currently needed only on Windows).
! self.prelink_hook()
 
 self.compiler.link_shared_object (
--- 418,424 ----
 extra_args = ext.extra_link_args
 
! # Bunch of fixing-up we have to do for Microsoft's linker.
! if self.compiler.compiler_type == 'msvc':
! self.msvc_prelink_hack(sources, ext, extra_args)
 
 self.compiler.link_shared_object (
***************
*** 504,514 ****
 # find_swig ()
 
- 
- # -- Hooks ---------------------------------------------------------
 
! def precompile_hook (self):
! pass
 
! def prelink_hook (self):
 
 # XXX this is a kludge! Knowledge of specific compilers or
--- 500,507 ----
 # find_swig ()
 
 
! # -- Hooks 'n hacks ------------------------------------------------
 
! def msvc_prelink_hack (self, sources, ext, extra_args):
 
 # XXX this is a kludge! Knowledge of specific compilers or
***************
*** 522,552 ****
 # excuse for committing more platform- and compiler-specific
 # kludges; they are to be avoided if possible!)
- if self.compiler.compiler_type == 'msvc':
- def_file = ext.export_symbol_file
- if def_file is None:
- source_dir = os.path.dirname (sources[0])
- ext_base = (string.split (ext.name, '.'))[-1]
- def_file = os.path.join (source_dir, "%s.def" % ext_base)
- if not os.path.exists (def_file):
- def_file = None
 
! if def_file is not None:
! extra_args.append ('/DEF:' + def_file)
! else:
! modname = string.split (ext.name, '.')[-1]
! extra_args.append('/export:init%s'%modname)
 
! # The MSVC linker generates unneeded .lib and .exp files,
! # which cannot be suppressed by any linker switches. So
! # make sure they are generated in the temporary build
! # directory.
! implib_file = os.path.join (
! self.build_temp,
! self.get_ext_libname (ext.name))
! extra_args.append ('/IMPLIB:' + implib_file)
! self.mkpath (os.path.dirname (implib_file))
! # if MSVC
 
! # prelink_hook ()
 
 
--- 515,544 ----
 # excuse for committing more platform- and compiler-specific
 # kludges; they are to be avoided if possible!)
 
! def_file = ext.export_symbol_file
! if def_file is None:
! source_dir = os.path.dirname (sources[0])
! ext_base = (string.split (ext.name, '.'))[-1]
! def_file = os.path.join (source_dir, "%s.def" % ext_base)
! if not os.path.exists (def_file):
! def_file = None
! 
! if def_file is not None:
! extra_args.append ('/DEF:' + def_file)
! else:
! modname = string.split (ext.name, '.')[-1]
! extra_args.append('/export:init%s' % modname)
 
! # The MSVC linker generates unneeded .lib and .exp files,
! # which cannot be suppressed by any linker switches. So
! # make sure they are generated in the temporary build
! # directory.
! implib_file = os.path.join (
! self.build_temp,
! self.get_ext_libname (ext.name))
! extra_args.append ('/IMPLIB:' + implib_file)
! self.mkpath (os.path.dirname (implib_file))
 
! # msvc_prelink_hack ()
 
 

AltStyle によって変換されたページ (->オリジナル) /