[pypy-svn] r77007 - pypy/branch/fast-forward/pypy/bin

afa at codespeak.net afa at codespeak.net
Sat Sep 11 00:50:39 CEST 2010


Author: afa
Date: Sat Sep 11 00:50:37 2010
New Revision: 77007

Modified:
   pypy/branch/fast-forward/pypy/bin/py.py
Log:
I don't know how to force an option to terminates the option list,
but at least this change does the right thing with:

    bin/py.py -m test.regrtest -v test_sys

i.e. '-v' is an option of the regrtest script, not for bin/py.py.


Modified: pypy/branch/fast-forward/pypy/bin/py.py
==============================================================================
--- pypy/branch/fast-forward/pypy/bin/py.py	(original)
+++ pypy/branch/fast-forward/pypy/bin/py.py	Sat Sep 11 00:50:37 2010
@@ -33,12 +33,12 @@
                default=False, cmdline="-O"),
     BoolOption("no_site_import", "do not 'import site' on initialization",
                default=False, cmdline="-S"),
-    StrOption("runmodule",
-              "library module to be run as a script (terminates option list)",
-              default=None, cmdline="-m"),
-    StrOption("runcommand",
-              "program passed in as CMD (terminates option list)",
-              default=None, cmdline="-c"),
+    BoolOption("runmodule",
+               "library module to be run as a script (terminates option list)",
+               default=False, cmdline="-m"),
+    BoolOption("runcommand",
+               "program passed in as CMD (terminates option list)",
+               default=False, cmdline="-c"),
     StrOption("warn",
               "warning control (arg is action:message:category:module:lineno)",
               default=None, cmdline="-W"),
@@ -116,19 +116,22 @@
     go_interactive = interactiveconfig.interactive
     banner = ''
     exit_status = 0
-    if interactiveconfig.runcommand is not None:
-        args = ['-c'] + args
+    command = None
+    if interactiveconfig.runcommand:
+        command = args[0]
+        args[0] = '-c'
+    if interactiveconfig.runmodule:
+        command = args.pop(0)
     for arg in args:
         space.call_method(space.sys.get('argv'), 'append', space.wrap(arg))
 
     # load the source of the program given as command-line argument
-    if interactiveconfig.runcommand is not None:
+    if interactiveconfig.runcommand:
         def doit():
-            main.run_string(interactiveconfig.runcommand, space=space)
+            main.run_string(command, space=space)
     elif interactiveconfig.runmodule:
         def doit():
-            main.run_module(interactiveconfig.runmodule,
-                            args, space=space)
+            main.run_module(command, args, space=space)
     elif args:
         scriptdir = os.path.dirname(os.path.abspath(args[0]))
         space.call_method(space.sys.get('path'), 'insert',



More information about the Pypy-commit mailing list