[Jython-checkins] jython: Minor clean-up in jython.java and fix --version option (is -V not -v).

jeff.allen jython-checkins at python.org
Sun Sep 23 09:57:16 EDT 2018


https://hg.python.org/jython/rev/3ca459532036
changeset:   8183:3ca459532036
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Sat Sep 22 20:39:30 2018 +0100
summary:
  Minor clean-up in jython.java and fix --version option (is -V not -v).

files:
  src/org/python/util/jython.java |  28 ++++++++++++++------
  1 files changed, 19 insertions(+), 9 deletions(-)


diff --git a/src/org/python/util/jython.java b/src/org/python/util/jython.java
--- a/src/org/python/util/jython.java
+++ b/src/org/python/util/jython.java
@@ -16,7 +16,6 @@
 import org.python.Version;
 import org.python.core.BytecodeLoader;
 import org.python.core.CompileMode;
-import org.python.core.CompilerFlags;
 import org.python.core.Options;
 import org.python.core.PrePy;
 import org.python.core.Py;
@@ -60,10 +59,10 @@
             + "-Dprop=v : Set the property `prop' to value `v'\n"
             + "-E       : ignore environment variables (such as JYTHONPATH)\n"
             + "-h       : print this help message and exit (also --help)\n"
-            + "-i       : inspect interactively after running script; forces a prompt even"
+            + "-i       : inspect interactively after running script; forces a prompt even\n"
             + "           if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n"
-            + "-jar jar : program read from __run__.py in jar file (deprecated).\n"
-            + "           Use PEP 338 support for jar file as argument (runs __main__.py).\n"
+            + "-jar jar : program read from __run__.py in jar file. Deprecated: instead,\n"
+            + "           name the archive as the file argument (runs __main__.py).\n"
             + "-m mod   : run library module as a script (terminates option list)\n"
             // + "-O       : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n"
             // + "-OO      : remove doc-strings in addition to the -O optimizations\n"
@@ -89,7 +88,7 @@
             + "JYTHONSTARTUP: file executed on interactive startup (no default)\n"
             + "JYTHONPATH   : '" + File.pathSeparator
             + "'-separated list of directories prefixed to the default module\n"
-            + "            search path.  The result is sys.path.\n"
+            + "               search path.  The result is sys.path.\n"
             + "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.";
     // @formatter:on
 
@@ -658,6 +657,7 @@
         return defaultValue;
     }
 
+    /** Non-fatal error message when ignoring unsupported option (usually one valid for CPython). */
     private static void optionNotSupported(char option) {
         printError("Option -%c is not supported", option);
     }
@@ -692,26 +692,37 @@
      */
     static class CommandLineOptions {
 
+        /** Possible actions to take after processing the options. */
         enum Action {
             RUN, ERROR, HELP, VERSION
         };
 
+        /** The action to take after processing the options. */
         Action action = Action.RUN;
+        /** Set informatively when {@link #action}{@code ==ERROR}. */
         String message = "";
 
+        /** Argument to the -c option. */
         String command;
+        /** First argument that is not an option (therefore the executable file). */
         String filename;
+        /** Argument to the -m option. */
         String module;
 
+        /** -h or --help option. */
         boolean help = false;
+        /** -V or --version option. */
         boolean version = false;
+        /** -jar option. */
         boolean jar = false;
 
+        /** Collects definitions made with the -D option directly to Jython (not java -D). */
         Properties properties = new Properties();
 
+        /** Arguments after the first non-option, therefore arguments to the executable program. */
         List<String> argv = new LinkedList<String>();
+        /** Arguments collected from succesive -W options. */
         List<String> warnoptions = new LinkedList<String>();
-        CompilerFlags cf = new CompilerFlags();
 
         /** Valid single character options. ':' means expect an argument following. */
         // XJD are extra to CPython. X and J are sanctioned while D is potentially a clash.
@@ -720,10 +731,9 @@
         /** Valid long-name options. */
         static final char JAR_OPTION = '\u2615';
         static final OptionScanner.LongSpec[] PROGRAM_LONG_OPTS = {
-                // new OptionScanner.LongSpec("-", OptionScanner.DONE),
                 new OptionScanner.LongSpec("--", OptionScanner.DONE),
                 new OptionScanner.LongSpec("--help", 'h'),
-                new OptionScanner.LongSpec("--version", 'v'),
+                new OptionScanner.LongSpec("--version", 'V'),
                 new OptionScanner.LongSpec("-jar", JAR_OPTION, true), // Yes, just one dash.
         };
 
@@ -944,7 +954,7 @@
 
         /**
          * Helper for option {@code -Dprop=v}. This is potentially a clash with Python: work around
-         * for luncher misplacement of -J-D...?
+         * for launcher misplacement of -J-D...?
          */
         private void optionD(OptionScanner scanner) throws SecurityException {
             String[] kv = scanner.getWholeArgument().split("=", 2);

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list