From: stevenknight Date: Mon, 21 Jul 2003 05:56:00 +0000 (+0000) Subject: Call the debugger directly, don't re-execute Python to run it. (Laurent Pelecq) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f71445d674580dfd0a0cced91ac3fda4032391f9;p=scons.git Call the debugger directly, don't re-execute Python to run it. (Laurent Pelecq) git-svn-id: http://scons.tigris.org/svn/scons/trunk@740 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6e92bb72..37e36a84 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 2f04d41c..6aa45bac 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