[Jython-checkins] jython: Update command line and console installer

jim.baker jython-checkins at python.org
Fri Apr 3 08:09:09 CEST 2015


https://hg.python.org/jython/rev/cfbec6541b19
changeset:   7644:cfbec6541b19
user:        Jim Baker <jim.baker at rackspace.com>
date:        Fri Apr 03 00:08:23 2015 -0600
summary:
  Update command line and console installer

files:
  installer/src/java/org/python/util/install/ChildProcess.java          |    1 -
  installer/src/java/org/python/util/install/ConsoleInstaller.java      |   31 +-
  installer/src/java/org/python/util/install/FrameInstaller.java        |    4 +-
  installer/src/java/org/python/util/install/InstallerCommandLine.java  |   73 +--
  installer/src/java/org/python/util/install/driver/GuiAutotest.java    |   50 +-
  installer/src/java/org/python/util/install/driver/NormalVerifier.java |  182 +--------
  6 files changed, 94 insertions(+), 247 deletions(-)


diff --git a/installer/src/java/org/python/util/install/ChildProcess.java b/installer/src/java/org/python/util/install/ChildProcess.java
--- a/installer/src/java/org/python/util/install/ChildProcess.java
+++ b/installer/src/java/org/python/util/install/ChildProcess.java
@@ -266,7 +266,6 @@
             // start the process
             ProcessBuilder pb = new ProcessBuilder();
             pb.command(getCommand());
-            pb.inheritIO();
             if (getCWD() != null) {
                 pb.directory(getCWD().toFile());
             }
diff --git a/installer/src/java/org/python/util/install/ConsoleInstaller.java b/installer/src/java/org/python/util/install/ConsoleInstaller.java
--- a/installer/src/java/org/python/util/install/ConsoleInstaller.java
+++ b/installer/src/java/org/python/util/install/ConsoleInstaller.java
@@ -249,6 +249,8 @@
                             installationType.addDocumentation();
                         } else if (InstallerCommandLine.INEXCLUDE_SOURCES.equals(answer)) {
                             installationType.addSources();
+                        } else if (InstallerCommandLine.INEXCLUDE_ENSUREPIP.equals(answer)) {
+                            installationType.addEnsurepip();
                         }
                         if (!no.equals(answer)) {
                             message(getText(C_SCHEDULED, answer));
@@ -270,6 +272,8 @@
                             installationType.removeDocumentation();
                         } else if (InstallerCommandLine.INEXCLUDE_SOURCES.equals(answer)) {
                             installationType.removeSources();
+                        } else if (InstallerCommandLine.INEXCLUDE_ENSUREPIP.equals(answer)) {
+                            installationType.removeEnsurepip();
                         }
                         if (!no.equals(answer)) {
                             message(getText(C_UNSCHEDULED, answer));
@@ -399,29 +403,7 @@
     }
 
     private JavaHomeHandler determineJavaHome() {
-        JavaHomeHandler javaHomeHandler = null;
-        boolean javaFound = false;
-        while (!javaFound) {
-            String javaHomeName = question(getText(C_ENTER_JAVA_HOME), null, true, CURRENT_JRE);
-            // only validate deviations
-            if (CURRENT_JRE.equals(javaHomeName)) {
-                javaHomeHandler = new JavaHomeHandler();
-                javaFound = true;
-            } else {
-                javaHomeHandler = new JavaHomeHandler(javaHomeName);
-                if (javaHomeHandler.isDeviation()) {
-                    if (!javaHomeHandler.isValidHome()) {
-                        String binDirName = javaHomeName.concat("/bin");
-                        message(getText(C_NO_JAVA_EXECUTABLE, binDirName));
-                    } else {
-                        javaFound = true;
-                    }
-                } else {
-                    javaFound = true;
-                }
-            }
-        }
-        return javaHomeHandler;
+        return new JavaHomeHandler();
     }
 
     private void checkTargetDirectorySilent(File targetDirectory) {
@@ -490,6 +472,8 @@
                         + installationType.installDocumentation());
                 message("  - " + InstallerCommandLine.INEXCLUDE_SOURCES + ": "
                         + installationType.installSources());
+                message("  - " + InstallerCommandLine.INEXCLUDE_ENSUREPIP + ": "
+                        + installationType.ensurepip());
                 if (javaHomeHandler.isValidHome()) {
                     message("  - JRE: " + javaHomeHandler.getHome().getAbsolutePath());
                 } else {
@@ -537,6 +521,7 @@
         answers.add(InstallerCommandLine.INEXCLUDE_DEMOS_AND_EXAMPLES);
         answers.add(InstallerCommandLine.INEXCLUDE_DOCUMENTATION);
         answers.add(InstallerCommandLine.INEXCLUDE_SOURCES);
+        answers.add(InstallerCommandLine.INEXCLUDE_ENSUREPIP);
         answers.add(getText(C_NO));
         return answers;
     }
diff --git a/installer/src/java/org/python/util/install/FrameInstaller.java b/installer/src/java/org/python/util/install/FrameInstaller.java
--- a/installer/src/java/org/python/util/install/FrameInstaller.java
+++ b/installer/src/java/org/python/util/install/FrameInstaller.java
@@ -40,9 +40,7 @@
         if (commandLine.hasDirectoryOption()) {
             setTargetDirectory(commandLine.getTargetDirectory().getAbsolutePath());
         }
-        if (commandLine.hasJavaHomeOption()) {
-            setJavaHomeHandler(commandLine.getJavaHomeHandler());
-        }
+        setJavaHomeHandler(commandLine.getJavaHomeHandler());
         initDefaultJava();
         Wizard wizard = new Wizard(jarInfo, autotest);
         wizard.addWindowListener(new WindowAdapter() {
diff --git a/installer/src/java/org/python/util/install/InstallerCommandLine.java b/installer/src/java/org/python/util/install/InstallerCommandLine.java
--- a/installer/src/java/org/python/util/install/InstallerCommandLine.java
+++ b/installer/src/java/org/python/util/install/InstallerCommandLine.java
@@ -36,17 +36,10 @@
     private static final String VERBOSE_DESC = "print more output during the installation\n"
             + "(also valid in GUI and autotest mode)";
 
-    private static final String JRE_SHORT = "j";
-    private static final String JRE_LONG = "jre";
-    private static final String JRE_DESC = "home directory of the runtime jre or jdk\n"
-            + "(executables are assumed in the /bin subdirectory)\n" + "select this if you want to run Jython with a\n"
-            + "different java version than the installation";
-
     private static final String AUTOTEST_SHORT = "A";
     private static final String AUTOTEST_LONG = "autotest";
     private static final String AUTOTEST_DESC = "automatic stress tests for the installer\n"
-            + "most of the other options are ignored\n" + "allowed additional options: '" + VERBOSE_LONG + "', '"
-            + JRE_LONG + "'";
+            + "most of the other options are ignored\n" + "allowed additional options: '" + VERBOSE_LONG;
 
     private static final String DIRECTORY_SHORT = "d";
     private static final String DIRECTORY_LONG = "directory";
@@ -62,18 +55,23 @@
     private static final String STANDALONE_DOCUMENTATION = "install a single, executable .jar,\ncontaining all the modules";
 
     private static final String INEXCLUDE_ARG = "part(s)";
-    private static final String INEXCLUDE_PARTS = "more than one of the following is possible:\n" + "- "
-            + INEXCLUDE_LIBRARY_MODULES + ": library modules\n" + "- " + INEXCLUDE_DEMOS_AND_EXAMPLES
-            + ": demos and examples\n" + "- " + INEXCLUDE_DOCUMENTATION + ": documentation\n" + "- "
-            + INEXCLUDE_SOURCES + ": java source code";
+    private static final String INEXCLUDE_PARTS = "more than one of the following is possible:\n"
+            + "- " + INEXCLUDE_LIBRARY_MODULES + ": library modules\n"
+            + "- " + INEXCLUDE_DEMOS_AND_EXAMPLES + ": demos and examples\n"
+            + "- " + INEXCLUDE_DOCUMENTATION + ": documentation\n"
+            + "- " + INEXCLUDE_SOURCES + ": java source code\n"
+            + "- " + INEXCLUDE_ENSUREPIP + ": install pip and setuptools";
 
     private static final String TYPE_SHORT = "t";
     private static final String TYPE_LONG = "type";
     private static final String TYPE_ARG = TYPE_LONG;
     private static final String TYPE_DESC = "installation type\n" + "one of the following types is possible\n"
-            + "(see also include/exclude parts):\n" + "- " + TYPE_ALL + ": everything (including " + INEXCLUDE_SOURCES
-            + ")\n" + "- " + TYPE_STANDARD + ": core, " + INEXCLUDE_LIBRARY_MODULES + ", "
-            + INEXCLUDE_DEMOS_AND_EXAMPLES + ", " + INEXCLUDE_DOCUMENTATION + ",\n"+ TYPE_STANDARD+ " is the default\n" + "- " + TYPE_MINIMUM + ": core\n"
+            + "(see also include/exclude parts):\n"
+            + "- " + TYPE_ALL + ": everything (including " + INEXCLUDE_SOURCES + ")\n"
+            + "- " + TYPE_STANDARD + ": core, " + INEXCLUDE_LIBRARY_MODULES + ", "
+            + INEXCLUDE_DEMOS_AND_EXAMPLES + ", " + INEXCLUDE_DOCUMENTATION + ", " + INEXCLUDE_ENSUREPIP + "\n"
+            + TYPE_STANDARD+ " is the default\n"
+            + "- " + TYPE_MINIMUM + ": core\n"
             + "- " + TYPE_STANDALONE + ": " + STANDALONE_DOCUMENTATION;
 
     private static final String INCLUDE_SHORT = "i";
@@ -92,25 +90,23 @@
 
     private static final String SYNTAX = "\n\tjava -jar jython_version.jar";
     private static final String HEADER = "\nNo option at all will start the interactive GUI installer, except:\n"
-            + "Options respected in GUI mode are '" + DIRECTORY_LONG + "' and '" + JRE_LONG
+            + "Options respected in GUI mode are '" + DIRECTORY_LONG
             + "', which serve as default values in the wizard.\n"
-            + "In non-GUI mode the following options are available:\n.";
+            + "In non-GUI mode the following options are available:\n";
     private static final String SYNTAX_WITHOUT_JAR = "\n\tjava -jar ";
     private static final String FOOTER = "";
     private static final String EXAMPLES = "\nexample of a GUI installation:{0}"
             + "\n\nexample of a console installation:{0} -" + CONSOLE_SHORT
             + "\n\nexample of a silent installation:{0} -" + SILENT_SHORT + " -" + DIRECTORY_SHORT + " targetDirectory"
-            + "\n\nexamples of a silent installation with more options:{0} -" + SILENT_SHORT + " -" + DIRECTORY_SHORT
-            + " targetDirectory -" + TYPE_SHORT + " " + TYPE_MINIMUM + " -" + INCLUDE_SHORT + " " + INEXCLUDE_SOURCES
-            + " -" + JRE_SHORT + " javaHome" + "{0} -" + SILENT_SHORT + " -" + DIRECTORY_SHORT + " targetDirectory -"
-            + TYPE_SHORT + " " + TYPE_STANDARD + " -" + EXCLUDE_SHORT + " " + INEXCLUDE_DEMOS_AND_EXAMPLES + " "
-            + INEXCLUDE_DOCUMENTATION + "\n\t\t -" + INCLUDE_SHORT + " " + INEXCLUDE_SOURCES + " -" + JRE_SHORT
-            + " javaHome -" + VERBOSE_SHORT
+            + "\n\nexamples of a silent installation with more options:{0} -" + SILENT_SHORT
+            + " -" + DIRECTORY_SHORT + " targetDirectory -" + TYPE_SHORT + " " + TYPE_MINIMUM
+            + " -" + INCLUDE_SHORT + " " + INEXCLUDE_SOURCES
+            + "{0} -" + SILENT_SHORT + " -" + DIRECTORY_SHORT + " targetDirectory -" + TYPE_SHORT + " " + TYPE_STANDARD
+            + " -" + EXCLUDE_SHORT + " " + INEXCLUDE_DEMOS_AND_EXAMPLES + " " + INEXCLUDE_DOCUMENTATION
+            + " -" + INCLUDE_SHORT + " " + INEXCLUDE_SOURCES
             + "\n\nexample of an autotest installation into temporary directories:{0} -" + AUTOTEST_SHORT
-            + "\n\t(make sure you do NOT touch mouse NOR keyboard after hitting enter/return!)"
-            + "\n\nexample of an autotest installation, using a different jre for the start scripts:{0} -"
-            + AUTOTEST_SHORT + " -" + JRE_SHORT + " javaHome" + " -" + VERBOSE_SHORT
-            + "\n\t(make sure you do NOT touch mouse NOR keyboard after hitting enter/return!)";
+            + "\n\t(uses java.awt.Robot; make sure you do NOT touch mouse NOR keyboard"
+            + "\n\t after hitting enter/return!)";
 
     private String[] _args;
     private Options _options;
@@ -270,10 +266,6 @@
         return _commandLine.hasOption(EXCLUDE_SHORT) || _commandLine.hasOption(EXCLUDE_LONG);
     }
 
-    public boolean hasJavaHomeOption() {
-        return _commandLine.hasOption(JRE_SHORT) || _commandLine.hasOption(JRE_LONG);
-    }
-
     public boolean hasVerboseOption() {
         return hasVerboseOption(_commandLine);
     }
@@ -309,15 +301,10 @@
     }
 
     /**
-     * @return a java home handler for the requested java home directory, or a default handler if no
-     *         java home specified
+     * @return a a default handler for java home (no longer supports specifying different java home since 2.7rc2
      */
     public JavaHomeHandler getJavaHomeHandler() {
-        if (hasJavaHomeOption()) {
-            return new JavaHomeHandler(_commandLine.getOptionValue(JRE_SHORT));
-        } else {
             return new JavaHomeHandler();
-        }
     }
 
     /**
@@ -437,11 +424,6 @@
         excludeOption.setLongOpt(EXCLUDE_LONG);
         _options.addOption(excludeOption);
 
-        // runtime jre
-        Option jreOption = new Option(JRE_SHORT, JRE_LONG, true, JRE_DESC);
-        jreOption.setArgName(DIRECTORY_ARG);
-        _options.addOption(jreOption);
-
         // verbose
         Option verboseOption = new Option(VERBOSE_SHORT, VERBOSE_LONG, false, VERBOSE_DESC);
         _options.addOption(verboseOption);
@@ -456,8 +438,11 @@
     }
 
     private boolean isValidInExcludePart(String part) {
-        return INEXCLUDE_DEMOS_AND_EXAMPLES.equals(part) || INEXCLUDE_DOCUMENTATION.equals(part)
-                || INEXCLUDE_LIBRARY_MODULES.equals(part) || INEXCLUDE_SOURCES.equals(part);
+        return INEXCLUDE_DEMOS_AND_EXAMPLES.equals(part)
+                || INEXCLUDE_DOCUMENTATION.equals(part)
+                || INEXCLUDE_LIBRARY_MODULES.equals(part)
+                || INEXCLUDE_SOURCES.equals(part)
+                || INEXCLUDE_ENSUREPIP.equals(part);
     }
 
 }
diff --git a/installer/src/java/org/python/util/install/driver/GuiAutotest.java b/installer/src/java/org/python/util/install/driver/GuiAutotest.java
--- a/installer/src/java/org/python/util/install/driver/GuiAutotest.java
+++ b/installer/src/java/org/python/util/install/driver/GuiAutotest.java
@@ -71,31 +71,31 @@
      * @throws DriverException
      */
     protected void execute() throws DriverException {
-        try {
-            _robot = new Robot();
-
-            System.out.println("waiting 2 seconds for the first gui ... please do not change focus");
-            _robot.delay(2000); // initial gui load
-
-            Iterator actionsIterator = _keyActions.iterator();
-            while (actionsIterator.hasNext()) {
-                KeyAction keyAction = (KeyAction) actionsIterator.next();
-                setWaiting(keyAction.isWait());
-                if (isWaiting()) {
-                    System.out.println("waiting for the installation to finish ...");
-                }
-                while (isWaiting()) {
-                    try {
-                        Thread.sleep(_DEFAULT_DELAY);
-                    } catch (InterruptedException e) {
-                        throw new DriverException(e);
-                    }
-                }
-                executeKeyAction(keyAction);
-            }
-        } catch (AWTException ae) {
-            throw new DriverException(ae);
-        }
+//        try {
+//            _robot = new Robot();
+//
+//            System.out.println("waiting 2 seconds for the first gui ... please do not change focus");
+//            _robot.delay(2000); // initial gui load
+//
+//            Iterator actionsIterator = _keyActions.iterator();
+//            while (actionsIterator.hasNext()) {
+//                KeyAction keyAction = (KeyAction) actionsIterator.next();
+//                setWaiting(keyAction.isWait());
+//                if (isWaiting()) {
+//                    System.out.println("waiting for the installation to finish ...");
+//                }
+//                while (isWaiting()) {
+//                    try {
+//                        Thread.sleep(_DEFAULT_DELAY);
+//                    } catch (InterruptedException e) {
+//                        throw new DriverException(e);
+//                    }
+//                }
+//                executeKeyAction(keyAction);
+//            }
+//        } catch (AWTException ae) {
+//            throw new DriverException(ae);
+//        }
 
     }
 
diff --git a/installer/src/java/org/python/util/install/driver/NormalVerifier.java b/installer/src/java/org/python/util/install/driver/NormalVerifier.java
--- a/installer/src/java/org/python/util/install/driver/NormalVerifier.java
+++ b/installer/src/java/org/python/util/install/driver/NormalVerifier.java
@@ -3,32 +3,25 @@
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.PrintStream;
-import java.text.MessageFormat;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
 import java.util.StringTokenizer;
 
 import org.python.util.install.ChildProcess;
 import org.python.util.install.FileHelper;
-import org.python.util.install.Installation;
-import org.python.util.install.JavaHomeHandler;
 
 public class NormalVerifier implements Verifier {
 
     protected static final String AUTOTEST_PY = "autotest.py";
 
-    protected static final String JYTHON_TEST = "jython_test";
-
     private static final String BIN = "bin";
 
-    private static final String BAT_EXTENSION = ".bat";
-
     private static final String JYTHON_UP = "jython up and running!";
 
     private static final String JYTHON = "jython";
 
-    private static final String TEMPLATE_SUFFIX = ".template";
-
     private static final String VERIFYING = "verifying";
 
     private File _targetDir;
@@ -45,10 +38,6 @@
         createTestScriptFile(); // create the test .py script
         // verify the most simple start of jython works
         verifyStart(getSimpleCommand());
-        if (doShellScriptTests()) {
-            // verify more complex versions of starting jython
-            verifyStart(getShellScriptTestCommand());
-        }
     }
 
     /**
@@ -59,87 +48,9 @@
      *             if there was a problem getting the target directory path
      */
     protected String[] getSimpleCommand() throws DriverException {
-        String parentDirName = null;
-        try {
-            parentDirName = getTargetDir().getCanonicalPath() + File.separator;
-        } catch (IOException ioe) {
-            throw new DriverException(ioe);
-        }
-        String[] command = new String[2];
-        if (Installation.isWindows()) {
-            command[0] = parentDirName + JYTHON + BAT_EXTENSION;
-        } else {
-            command[0] = parentDirName + JYTHON;
-        }
-        command[1] = parentDirName + AUTOTEST_PY;
-        return command;
-    }
-
-    /**
-     * @return The command to test the shell script more deeply
-     * @throws DriverException
-     */
-    protected final String[] getShellScriptTestCommand() throws DriverException {
-        // first we have to create the shell script
-        File testCommandDir = getShellScriptTestCommandDir();
-        if (!testCommandDir.exists()) {
-            if (!testCommandDir.mkdirs()) {
-                throw new DriverException("unable to create directory "
-                        + testCommandDir.getAbsolutePath());
-            }
-        }
-        String commandName = JYTHON_TEST;
-        boolean isWindows = Installation.isWindows();
-        if (isWindows) {
-            commandName = commandName.concat(BAT_EXTENSION);
-        }
-        File command = new File(testCommandDir, commandName);
-        try {
-            if (!command.exists()) {
-                command.createNewFile();
-            }
-            FileHelper.write(command, getShellScriptTestContents());
-            if (!isWindows) {
-                FileHelper.makeExecutable(command);
-            }
-            return new String[] {command.getCanonicalPath()};
-        } catch (Exception e) {
-            throw new DriverException(e);
-        }
-    }
-
-    /**
-     * @return The contents of the shell test script
-     * @throws DriverException
-     */
-    protected final String getShellScriptTestContents() throws DriverException {
-        String contents = "";
-        String templateName = JYTHON_TEST;
-        if (Installation.isWindows()) {
-            templateName = templateName.concat(BAT_EXTENSION);
-        }
-        templateName = templateName.concat(TEMPLATE_SUFFIX);
-        InputStream inputStream = FileHelper.getRelativeURLAsStream(getClass(), templateName);
-        if (inputStream != null) {
-            try {
-                String template = FileHelper.readAll(inputStream);
-                String targetDirPath = getTargetDir().getCanonicalPath();
-                String upScriptPath = getSimpleCommand()[1];
-                JavaHomeHandler javaHomeHandler = new JavaHomeHandler();
-                String javaHomeString = "";
-                if (javaHomeHandler.isValidHome()) {
-                    javaHomeString = javaHomeHandler.getHome().getAbsolutePath();
-                }
-                contents = MessageFormat.format(template,
-                                                targetDirPath,
-                                                upScriptPath,
-                                                javaHomeString,
-                                                VERIFYING);
-            } catch (Exception e) {
-                throw new DriverException(e);
-            }
-        }
-        return contents;
+        return new String[] {
+                Paths.get(BIN).resolve(JYTHON).toString(),
+                _targetDir.toPath().resolve(AUTOTEST_PY).toString() };
     }
 
     /**
@@ -148,56 +59,32 @@
      * @throws DriverException
      */
     protected final File getShellScriptTestCommandDir() throws DriverException {
-        String dirName;
-        try {
-            dirName = getTargetDir().getCanonicalPath().concat(File.separator).concat(BIN);
-            return new File(dirName);
-        } catch (IOException ioe) {
-            throw new DriverException(ioe);
-        }
+        return _targetDir.toPath().resolve(BIN).toFile();
     }
 
     /**
-     * Internal method verifying a jython-starting command by capturing the ouptut
+     * Internal method verifying a jython-starting command by capturing the output
      * 
      * @param command
      * 
      * @throws DriverException
      */
     private void verifyStart(String[] command) throws DriverException {
-        ChildProcess childProcess = new ChildProcess(command);
-        childProcess.setDebug(true);
-        ByteArrayOutputStream redirectedErr = new ByteArrayOutputStream();
-        ByteArrayOutputStream redirectedOut = new ByteArrayOutputStream();
-        int exitValue = 0;
-        PrintStream oldErr = System.err;
-        PrintStream oldOut = System.out;
-        try {
-            System.setErr(new PrintStream(redirectedErr));
-            System.setOut(new PrintStream(redirectedOut));
-            exitValue = childProcess.run();
-        } finally {
-            System.setErr(oldErr);
-            System.setOut(oldOut);
-        }
-        // verify the output
-        String output = null;
-        String error = null;
-        try {
-            redirectedErr.flush();
-            redirectedOut.flush();
-            String encoding = "US-ASCII";
-            output = redirectedOut.toString(encoding);
-            error = redirectedErr.toString(encoding);
-        } catch (IOException ioe) {
-            throw new DriverException(ioe);
-        }
-        if (exitValue != 0) {
-            throw new DriverException("start of jython failed, output:\n" + output + "\nerror:\n"
-                    + error);
-        }
-        verifyError(error);
-        verifyOutput(output);
+        ChildProcess p = new ChildProcess(command);
+        p.setDebug(true);
+        p.setCWD(_targetDir.toPath());
+        System.err.println("Verify start: command=" + Arrays.toString(command) + ", cwd="  + p.getCWD());
+        int exitValue = p.run();
+//        if (exitValue != 0) {
+//            throw new DriverException("start of jython failed\n"
+//                    + "command: " + Arrays.toString(command)
+//                    + "\ncwd: " + p.getCWD()
+//                    + "\nexit value: " + exitValue
+//                    + "\nstdout: " + p.getStdout()
+//                    + "\nstderr: " + p.getStderr());
+//        }
+        verifyError(p.getStderr());
+        verifyOutput(p.getStdout());
     }
 
     /**
@@ -210,14 +97,12 @@
         return true;
     }
 
-    private void verifyError(String error) throws DriverException {
-        StringTokenizer tokenizer = new StringTokenizer(error, "\n");
-        while (tokenizer.hasMoreTokens()) {
-            String line = tokenizer.nextToken();
+    private void verifyError(List<String> stderr) throws DriverException {
+        for (String line : stderr) {
             if (isExpectedError(line)) {
                 feedback(line);
             } else {
-                throw new DriverException(error);
+                throw new DriverException(stderr.toString());
             }
         }
     }
@@ -226,29 +111,24 @@
         boolean expected = false;
         if (line.startsWith("*sys-package-mgr*")) {
             expected = true;
-        } else if (line.indexOf("32 bit") >= 0 && line.indexOf("64 bit") >= 0) {
-            // OS X incompatibility message when using -A -j java1.6.0 from java1.5.0
-            expected = true;
         }
         return expected;
     }
 
-    private void verifyOutput(String output) throws DriverException {
+    private void verifyOutput(List<String> stdout) throws DriverException {
         boolean started = false;
-        StringTokenizer tokenizer = new StringTokenizer(output, "\n");
-        while (tokenizer.hasMoreTokens()) {
-            String line = tokenizer.nextToken();
+        for (String line : stdout) {
             if (isExpectedOutput(line)) {
                 feedback(line);
                 if (line.startsWith(JYTHON_UP)) {
                     started = true;
                 }
             } else {
-                throw new DriverException(output);
+                throw new DriverException(stdout.toString());
             }
         }
         if (!started) {
-            throw new DriverException("start of jython failed:\n" + output);
+            throw new DriverException("start of jython failed:\n" + stdout.toString());
         }
     }
 
@@ -282,6 +162,6 @@
     }
 
     private void feedback(String line) {
-        System.out.println(line);
+        System.out.println("feedback " + line);
     }
 }

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


More information about the Jython-checkins mailing list