diff options
author | Greg Ward <gward@python.net> | 2000-02-09 02:20:14 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-02-09 02:20:14 (GMT) |
commit | e8c6ce4684eaae101d9053abdc9df8df828e92a7 (patch) | |
tree | 3a81ed74c381236b03fe844898905a20f42c004a | |
parent | 324620015d0cd1616af5e1a5787b2b0c9d345fd3 (diff) | |
download | cpython-e8c6ce4684eaae101d9053abdc9df8df828e92a7.zip cpython-e8c6ce4684eaae101d9053abdc9df8df828e92a7.tar.gz cpython-e8c6ce4684eaae101d9053abdc9df8df828e92a7.tar.bz2 |
Added 'debug' option, and changed compile/link calls to use it.
-rw-r--r-- | Lib/distutils/command/build_clib.py | 12 | ||||
-rw-r--r-- | Lib/distutils/command/build_ext.py | 16 | ||||
-rw-r--r-- | Lib/distutils/command/build_lib.py | 12 |
3 files changed, 30 insertions, 10 deletions
diff --git a/Lib/distutils/command/build_clib.py b/Lib/distutils/command/build_clib.py index c638fd5..6571281 100644 --- a/Lib/distutils/command/build_clib.py +++ b/Lib/distutils/command/build_clib.py @@ -28,7 +28,9 @@ from distutils.ccompiler import new_compiler class BuildLib (Command): - options = [] + options = [('debug', 'g', + "compile with debugging information"), + ] def set_default_options (self): # List of libraries to build @@ -38,10 +40,13 @@ class BuildLib (Command): self.include_dirs = None self.define = None self.undef = None + self.debug = None # set_default_options() def set_final_options (self): + self.set_undefined_options ('build', + ('debug', 'debug')) self.libraries = self.distribution.libraries if self.include_dirs is None: self.include_dirs = self.distribution.include_dirs or [] @@ -146,12 +151,13 @@ class BuildLib (Command): objects = self.compiler.compile (sources, macros=macros, include_dirs=include_dirs, - output_dir=lib_dir) + output_dir=lib_dir, + debug=self.debug) # Now "link" the object files together into a static library. # (On Unix at least, this isn't really linking -- it just # builds an archive. Whatever.) - self.compiler.link_static_lib (objects, lib_name) + self.compiler.link_static_lib (objects, lib_name, debug=self.debug) # for libraries diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 0f2d1a7..14c2234 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -58,6 +58,8 @@ class BuildExt (Command): "directories to search for shared C libraries at runtime"), ('link-objects=', 'O', "extra explicit link objects to include in the link"), + ('debug', 'g', + "compile/link with debugging information"), ] @@ -73,12 +75,15 @@ class BuildExt (Command): self.library_dirs = None self.rpath = None self.link_objects = None + self.debug = None def set_final_options (self): from distutils import sysconfig - self.set_undefined_options ('build', ('build_platlib', 'build_dir')) + self.set_undefined_options ('build', + ('build_platlib', 'build_dir'), + ('debug', 'debug')) if self.package is None: self.package = self.distribution.ext_package @@ -223,7 +228,8 @@ class BuildExt (Command): include_dirs = build_info.get ('include_dirs') self.compiler.compile (sources, macros=macros, - include_dirs=include_dirs) + include_dirs=include_dirs, + debug=self.debug) # Now link the object files together into a "shared object" -- # of course, first we have to figure out all the other things @@ -236,7 +242,8 @@ class BuildExt (Command): library_dirs = build_info.get ('library_dirs') extra_args = build_info.get ('extra_link_args') or [] if self.compiler.compiler_type == 'msvc': - extra_args.append ('/export:init%s' % extension_name) + mod_name = string.split (extension_name, '.')[-1] + extra_args.append ('/export:init%s' % mod_name) ext_filename = self.extension_filename \ (extension_name, self.package) @@ -246,7 +253,8 @@ class BuildExt (Command): self.compiler.link_shared_object (objects, ext_filename, libraries=libraries, library_dirs=library_dirs, - extra_postargs=extra_args) + extra_postargs=extra_args, + debug=self.debug) # build_extensions () diff --git a/Lib/distutils/command/build_lib.py b/Lib/distutils/command/build_lib.py index c638fd5..6571281 100644 --- a/Lib/distutils/command/build_lib.py +++ b/Lib/distutils/command/build_lib.py @@ -28,7 +28,9 @@ from distutils.ccompiler import new_compiler class BuildLib (Command): - options = [] + options = [('debug', 'g', + "compile with debugging information"), + ] def set_default_options (self): # List of libraries to build @@ -38,10 +40,13 @@ class BuildLib (Command): self.include_dirs = None self.define = None self.undef = None + self.debug = None # set_default_options() def set_final_options (self): + self.set_undefined_options ('build', + ('debug', 'debug')) self.libraries = self.distribution.libraries if self.include_dirs is None: self.include_dirs = self.distribution.include_dirs or [] @@ -146,12 +151,13 @@ class BuildLib (Command): objects = self.compiler.compile (sources, macros=macros, include_dirs=include_dirs, - output_dir=lib_dir) + output_dir=lib_dir, + debug=self.debug) # Now "link" the object files together into a static library. # (On Unix at least, this isn't really linking -- it just # builds an archive. Whatever.) - self.compiler.link_static_lib (objects, lib_name) + self.compiler.link_static_lib (objects, lib_name, debug=self.debug) # for libraries |