summaryrefslogtreecommitdiff
path: root/unixccompiler.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-09-27 02:08:14 +0000
committerGreg Ward <gward@python.net>2000-09-27 02:08:14 +0000
commit5937fb6402fd3826b37192fc61b0869f7c3e441d (patch)
treea3e82ad0525143976ef611628237b31a0fa64a29 /unixccompiler.py
parent3baf36cad7c938199bb27b95d25bcb5db2bb6cae (diff)
downloadpython-setuptools-git-5937fb6402fd3826b37192fc61b0869f7c3e441d.tar.gz
Big patch from Rene Liebscher to simplify the CCompiler API and
implementations. Details: * replace 'link_shared_object()', 'link_shared_lib()', and 'link_executable()' with 'link()', which is (roughly) the union of the three methods it replaces * in all implementation classes (UnixCCompiler, MSVCCompiler, etc.), ditch the old 'link_*()' methods and replace them with 'link()' * in the abstract base class (CCompiler), add the old 'link_*()' methods as wrappers around the new 'link()' (they also print a warning of the deprecated interface) Also increases consistency between MSVCCompiler and BCPPCompiler, hopefully to make it easier to factor out the mythical WindowsCCompiler class. Details: * use 'self.linker' instead of 'self.link' * add ability to compile resource files to BCPPCompiler * added (redundant?) 'object_filename()' method to BCPPCompiler * only generate a .def file if 'export_symbols' defined
Diffstat (limited to 'unixccompiler.py')
-rw-r--r--unixccompiler.py100
1 files changed, 18 insertions, 82 deletions
diff --git a/unixccompiler.py b/unixccompiler.py
index ff0341a5..f7eb93ae 100644
--- a/unixccompiler.py
+++ b/unixccompiler.py
@@ -190,45 +190,19 @@ class UnixCCompiler (CCompiler):
# create_static_lib ()
- def link_shared_lib (self,
- objects,
- output_libname,
- output_dir=None,
- libraries=None,
- library_dirs=None,
- runtime_library_dirs=None,
- export_symbols=None,
- debug=0,
- extra_preargs=None,
- extra_postargs=None,
- build_temp=None):
-
- self.link_shared_object(
- objects,
- self.library_filename(output_libname, lib_type='shared'),
- output_dir,
- libraries,
- library_dirs,
- runtime_library_dirs,
- export_symbols,
- debug,
- extra_preargs,
- extra_postargs,
- build_temp)
-
-
- def link_shared_object (self,
- objects,
- output_filename,
- output_dir=None,
- libraries=None,
- library_dirs=None,
- runtime_library_dirs=None,
- export_symbols=None,
- debug=0,
- extra_preargs=None,
- extra_postargs=None,
- build_temp=None):
+ def link (self,
+ target_desc,
+ objects,
+ output_filename,
+ output_dir=None,
+ libraries=None,
+ library_dirs=None,
+ runtime_library_dirs=None,
+ export_symbols=None,
+ debug=0,
+ extra_preargs=None,
+ extra_postargs=None,
+ build_temp=None):
(objects, output_dir) = self._fix_object_args(objects, output_dir)
(libraries, library_dirs, runtime_library_dirs) = \
@@ -253,54 +227,16 @@ class UnixCCompiler (CCompiler):
ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename))
try:
- self.spawn(self.linker_so + ld_args)
+ if target_desc == CCompiler.EXECUTABLE:
+ self.spawn(self.linker_exe + ld_args)
+ else:
+ self.spawn(self.linker_so + ld_args)
except DistutilsExecError, msg:
raise LinkError, msg
else:
self.announce("skipping %s (up-to-date)" % output_filename)
- # link_shared_object ()
-
-
- def link_executable (self,
- objects,
- output_progname,
- output_dir=None,
- libraries=None,
- library_dirs=None,
- runtime_library_dirs=None,
- debug=0,
- extra_preargs=None,
- extra_postargs=None):
-
- (objects, output_dir) = self._fix_object_args(objects, output_dir)
- (libraries, library_dirs, runtime_library_dirs) = \
- self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
-
- lib_opts = gen_lib_options(self,
- library_dirs, runtime_library_dirs,
- libraries)
- output_filename = output_progname # Unix-ism!
- if output_dir is not None:
- output_filename = os.path.join(output_dir, output_filename)
-
- if self._need_link(objects, output_filename):
- ld_args = objects + self.objects + lib_opts + ['-o', output_filename]
- if debug:
- ld_args[:0] = ['-g']
- if extra_preargs:
- ld_args[:0] = extra_preargs
- if extra_postargs:
- ld_args.extend(extra_postargs)
- self.mkpath(os.path.dirname(output_filename))
- try:
- self.spawn(self.linker_exe + ld_args)
- except DistutilsExecError, msg:
- raise LinkError, msg
- else:
- self.announce("skipping %s (up-to-date)" % output_filename)
-
- # link_executable ()
+ # link ()
# -- Miscellaneous methods -----------------------------------------