diff options
author | Steven Knight <knight@baldmt.com> | 2003-07-21 05:56:00 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-07-21 05:56:00 (GMT) |
commit | cf7a4545126e4fe5a0c36c0c26b74980d1c06c9a (patch) | |
tree | bf62bea1cebf69d2f9c287d821389c67b1fd87b7 | |
parent | 6c127c28c6924d7e5b8a0b8e1f2e348f6e53107c (diff) | |
download | SCons-cf7a4545126e4fe5a0c36c0c26b74980d1c06c9a.zip SCons-cf7a4545126e4fe5a0c36c0c26b74980d1c06c9a.tar.gz SCons-cf7a4545126e4fe5a0c36c0c26b74980d1c06c9a.tar.bz2 |
Call the debugger directly, don't re-execute Python to run it. (Laurent Pelecq)
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 48 |
2 files changed, 25 insertions, 28 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6e92bb7..37e36a8 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -47,6 +47,11 @@ RELEASE 0.XX - XXX - Fix the value returned by the Node.prevsiginfo() method to conform to a previous change when checking whether a node is current. + From Laurent Pelecq: + + - When the -debug=pdb option is specified, use pdb.Pdb().runcall() to + call pdb directly, don't call Python recursively. + From Christoph Wiedemann - Have the g++ Tool actually use g++ in preference to c++. diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 2f04d41..6aa45ba 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -458,23 +458,7 @@ class OptParser(OptionParser): "build all Default() targets.") def opt_debug(option, opt, value, parser): - if value == "pdb": - if os.name == 'java': - python = os.path.join(sys.prefix, 'jython') - else: - python = sys.executable - args = [ python, "pdb.py" ] + \ - filter(lambda x: x != "--debug=pdb", sys.argv) - if sys.platform == 'win32': - args[1] = os.path.join(sys.prefix, "lib", "pdb.py") - sys.exit(os.spawnve(os.P_WAIT, args[0], args, os.environ)) - else: - args[1] = os.path.join(sys.prefix, - "lib", - "python" + sys.version[0:3], - "pdb.py") - os.execvpe(args[0], args, os.environ) - elif value in ["tree", "dtree", "time", "includes"]: + if value in ["pdb","tree", "dtree", "time", "includes"]: setattr(parser.values, 'debug', value) else: raise OptionValueError("Warning: %s is not a valid debug type" % value) @@ -693,7 +677,7 @@ class SConscriptSettableOptions: self.settable[name] = value -def _main(): +def _main(args): targets = [] # Enable deprecated warnings by default. @@ -701,15 +685,7 @@ def _main(): SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning) SCons.Warnings.enableWarningClass(SCons.Warnings.CorruptSConsignWarning) - all_args = sys.argv[1:] - try: - all_args = string.split(os.environ['SCONSFLAGS']) + all_args - except KeyError: - # it's OK if there's no SCONSFLAGS - pass - parser = OptParser() - global options, ssoptions - options, args = parser.parse_args(all_args) + global ssoptions ssoptions = SConscriptSettableOptions(options) if options.help_msg: @@ -983,11 +959,27 @@ def _main(): if not options.noexec: SCons.Sig.write() +def _exec_main(): + all_args = sys.argv[1:] + try: + all_args = string.split(os.environ['SCONSFLAGS']) + all_args + except KeyError: + # it's OK if there's no SCONSFLAGS + pass + parser = OptParser() + global options + options, args = parser.parse_args(all_args) + if options.debug == "pdb": + import pdb + pdb.Pdb().runcall(_main, args) + else: + _main(args) + def main(): global exit_status try: - _main() + _exec_main() except SystemExit, s: if s: exit_status = s |