Fix the --debug=pdb option on Windows.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Feb 2002 17:31:10 +0000 (17:31 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 21 Feb 2002 17:31:10 +0000 (17:31 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@273 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Script/__init__.py
test/option--debug.py

index c30e871236000162f2bf7fb4963a4bcb8983bc26..4643b9a33de783cc49ef412aaa730910657b1deb 100644 (file)
@@ -71,6 +71,8 @@ RELEASE 0.05 -
   - Fix the -c option so it doesn't stop removing targets if one doesn't
     already exist.
 
+  - Fix the --debug=pdb option when run on Windows NT.
+
   From Steve Leblanc:
 
   - Add support for the -u option.
index aa4ecb4e90ec561e59e2ec21dc47058b9a7399f0..529729eaceb26b524b7910389f8e5d7ac794c9a1 100644 (file)
@@ -376,18 +376,16 @@ def options_init():
     def opt_debug(opt, arg):
         global print_tree
         if arg == "pdb":
-            if sys.platform == 'win32':
-                lib_dir = os.path.join(sys.exec_prefix, "lib")
-            else:
-                lib_dir = os.path.join(sys.exec_prefix,
-                                       "lib",
-                                       "python" + sys.version[0:3])
-            args = [ sys.executable, os.path.join(lib_dir, "pdb.py") ] + \
+            args = [ sys.executable, "pdb.py" ] + \
                      filter(lambda x: x != "--debug=pdb", sys.argv)
             if sys.platform == 'win32':
-                ret = os.spawnve(os.P_WAIT, cmd_interp, args, env)
-                sys.exit(ret)
+                args[1] = os.path.join(sys.exec_prefix, "lib", "pdb.py")
+                sys.exit(os.spawnve(os.P_WAIT, args[0], args, os.environ))
             else:
+                args[1] = os.path.join(sys.exec_prefix,
+                                       "lib",
+                                       "python" + sys.version[0:3],
+                                      "pdb.py")
                 os.execvpe(args[0], args, os.environ)
         elif arg == "tree":
             print_tree = 1
index 304b8bdfbe16c442f19739395e3dac90bbc79a02..35a3f066b0746730ea374a48bd31b20b7e0f2d01 100644 (file)
@@ -85,10 +85,14 @@ tree = """
       +-foo.h
 """ % (foo, obj,obj)
 
-assert string.find(test.stdout(), tree) != -1
+test.fail_test(string.find(test.stdout(), tree) == -1)
 
 test.run(arguments = "--debug=tree " + foo)
-assert string.find(test.stdout(), tree) != -1
+test.fail_test(string.find(test.stdout(), tree) == -1)
+
+test.run(arguments = "--debug=pdb", stdin = "n\ns\nq\n")
+test.fail_test(string.find(test.stdout(), "(Pdb)") == -1)
+test.fail_test(string.find(test.stdout(), "scons") == -1)
 
 test.pass_test()