From: <otm...@us...> - 2008-10-16 22:15:37
|
Revision: 5449 http://jython.svn.sourceforge.net/jython/?rev=5449&view=rev Author: otmarhumbel Date: 2008-10-16 22:15:33 +0000 (Thu, 16 Oct 2008) Log Message: ----------- making verbose mode a bit more verbose Modified Paths: -------------- trunk/installer/src/java/org/python/util/install/Installation.java Modified: trunk/installer/src/java/org/python/util/install/Installation.java =================================================================== --- trunk/installer/src/java/org/python/util/install/Installation.java 2008-10-16 21:21:08 UTC (rev 5448) +++ trunk/installer/src/java/org/python/util/install/Installation.java 2008-10-16 22:15:33 UTC (rev 5449) @@ -93,15 +93,15 @@ int major = 0; int minor = 0; StringTokenizer tokenizer = new StringTokenizer(specificationVersion, "."); - if( tokenizer.hasMoreTokens()) { + if (tokenizer.hasMoreTokens()) { major = Integer.valueOf(tokenizer.nextToken()).intValue(); } if (tokenizer.hasMoreTokens()) { minor = Integer.valueOf(tokenizer.nextToken()).intValue(); } boolean valid = true; - if( major == 1) { - if( minor < 2) { + if (major == 1) { + if (minor < 2) { valid = false; } } @@ -266,13 +266,27 @@ } public static boolean isGuiAllowed() { + boolean verbose = isVerbose(); + if (verbose) { + ConsoleInstaller.message("checking gui availability"); + } if (Boolean.getBoolean(HEADLESS_PROPERTY_NAME)) { return false; } try { + if (verbose) { + ConsoleInstaller.message("trying to get the graphics environment"); + } GraphicsEnvironment.getLocalGraphicsEnvironment(); + if (verbose) { + ConsoleInstaller.message("got the graphics environment!"); + } return true; } catch (Throwable t) { + if (verbose) { + ConsoleInstaller.message("got the following exception:"); + t.printStackTrace(); + } return false; } } @@ -299,13 +313,21 @@ */ private static void internalMain(String[] args, Autotest autotest, Tunnel tunnel) { try { + boolean earlyVerbose = InstallerCommandLine.hasVerboseOptionInArgs(args); + if (earlyVerbose) { + ConsoleInstaller.message("reading jar info"); + } JarInfo jarInfo = new JarInfo(); InstallerCommandLine commandLine = new InstallerCommandLine(jarInfo); if (!commandLine.setArgs(args) || commandLine.hasHelpOption()) { commandLine.printHelp(); System.exit(1); } else { + _verbose = commandLine.hasVerboseOption(); if (commandLine.hasAutotestOption()) { + if (isVerbose()) { + ConsoleInstaller.message("running autotests"); + } _isAutotesting = true; InstallationDriver autotestDriver = new InstallationDriver(commandLine); autotestDriver.drive(); // ! reentrant into internalMain() @@ -313,10 +335,10 @@ ConsoleInstaller.message("\ncongratulations - autotests complete !"); System.exit(0); } - if (commandLine.hasVerboseOption()) { - _verbose = true; - } if (!useGui(commandLine)) { + if (isVerbose()) { + ConsoleInstaller.message("using the console installer"); + } ConsoleInstaller consoleInstaller = new ConsoleInstaller(commandLine, jarInfo); consoleInstaller.setTunnel(tunnel); consoleInstaller.install(); @@ -324,6 +346,9 @@ System.exit(0); } } else { + if (isVerbose()) { + ConsoleInstaller.message("using the gui installer"); + } new FrameInstaller(commandLine, jarInfo, autotest); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2008-12-01 23:33:57
|
Revision: 5671 http://jython.svn.sourceforge.net/jython/?rev=5671&view=rev Author: otmarhumbel Date: 2008-12-01 23:33:55 +0000 (Mon, 01 Dec 2008) Log Message: ----------- dump system properties to a file (in verbose mode) Modified Paths: -------------- trunk/installer/src/java/org/python/util/install/Installation.java Modified: trunk/installer/src/java/org/python/util/install/Installation.java =================================================================== --- trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-01 18:33:00 UTC (rev 5670) +++ trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-01 23:33:55 UTC (rev 5671) @@ -6,6 +6,7 @@ import java.io.FilenameFilter; import java.io.IOException; import java.text.MessageFormat; +import java.util.Enumeration; import java.util.Locale; import java.util.Properties; import java.util.ResourceBundle; @@ -326,6 +327,7 @@ try { boolean earlyVerbose = InstallerCommandLine.hasVerboseOptionInArgs(args); if (earlyVerbose) { + dumpSystemProperties(); ConsoleInstaller.message("reading jar info"); } JarInfo jarInfo = new JarInfo(); @@ -371,5 +373,23 @@ System.exit(1); } } + + private static void dumpSystemProperties() throws IOException { + @SuppressWarnings("unchecked") + Enumeration<String> names = (Enumeration<String>)System.getProperties().propertyNames(); + StringBuilder contents = new StringBuilder(400); + contents.append("Properties at the beginning of the Jython installation:\n\n"); + while (names.hasMoreElements()) { + String name = names.nextElement(); + String value = System.getProperty(name, ""); + contents.append(name); + contents.append('='); + contents.append(value); + contents.append("\n"); + } + File output = File.createTempFile("System", ".properties"); + FileHelper.write(output, contents.toString()); + ConsoleInstaller.message("system properties dumped to " + output.getAbsolutePath()); + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2008-12-13 14:28:08
|
Revision: 5754 http://jython.svn.sourceforge.net/jython/?rev=5754&view=rev Author: otmarhumbel Date: 2008-12-13 14:27:58 +0000 (Sat, 13 Dec 2008) Log Message: ----------- fixed verbosity Modified Paths: -------------- trunk/installer/src/java/org/python/util/install/Installation.java Modified: trunk/installer/src/java/org/python/util/install/Installation.java =================================================================== --- trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-13 14:27:18 UTC (rev 5753) +++ trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-13 14:27:58 UTC (rev 5754) @@ -50,6 +50,10 @@ protected static boolean isVerbose() { return _verbose; } + + protected static void setVerbose(boolean verbose) { + _verbose = verbose; + } protected static boolean isAutotesting() { return _isAutotesting; @@ -321,8 +325,9 @@ */ private static void internalMain(String[] args, Autotest autotest, Tunnel tunnel) { try { - boolean earlyVerbose = InstallerCommandLine.hasVerboseOptionInArgs(args); - if (earlyVerbose) { + setVerbose(InstallerCommandLine.hasVerboseOptionInArgs(args)); + boolean verbose = isVerbose(); + if (verbose) { dumpSystemProperties(); ConsoleInstaller.message("reading jar info"); } @@ -332,9 +337,8 @@ commandLine.printHelp(); System.exit(1); } else { - _verbose = commandLine.hasVerboseOption(); if (commandLine.hasAutotestOption()) { - if (isVerbose()) { + if (verbose) { ConsoleInstaller.message("running autotests"); } _isAutotesting = true; @@ -345,7 +349,7 @@ System.exit(0); } if (!useGui(commandLine)) { - if (isVerbose()) { + if (verbose) { ConsoleInstaller.message("using the console installer"); } ConsoleInstaller consoleInstaller = new ConsoleInstaller(commandLine, jarInfo); @@ -355,7 +359,7 @@ System.exit(0); } } else { - if (isVerbose()) { + if (verbose) { ConsoleInstaller.message("using the gui installer"); } new FrameInstaller(commandLine, jarInfo, autotest); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2008-12-13 16:08:39
|
Revision: 5755 http://jython.svn.sourceforge.net/jython/?rev=5755&view=rev Author: otmarhumbel Date: 2008-12-13 16:08:36 +0000 (Sat, 13 Dec 2008) Log Message: ----------- use GraphicsEnvironment.isHeadless() to detect gui availability fixes issue #1658599 Modified Paths: -------------- trunk/installer/src/java/org/python/util/install/Installation.java Modified: trunk/installer/src/java/org/python/util/install/Installation.java =================================================================== --- trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-13 14:27:58 UTC (rev 5754) +++ trunk/installer/src/java/org/python/util/install/Installation.java 2008-12-13 16:08:36 UTC (rev 5755) @@ -91,9 +91,7 @@ protected static boolean isValidJava(JavaVersionInfo javaVersionInfo) { String specificationVersion = javaVersionInfo.getSpecificationVersion(); - if (Installation.isVerbose()) { - ConsoleInstaller.message("specification version: '" + specificationVersion + "'"); - } + verboseOutput("specification version: '" + specificationVersion + "'"); // major.minor.micro // according to http://java.sun.com/j2se/1.5.0/docs/guide/versioning/spec/versioning2.html int major = 0; @@ -175,10 +173,8 @@ command[2] = System.getProperty("java.class.path"); command[3] = JavaVersionTester.class.getName(); command[4] = tempFile.getAbsolutePath(); - if (isVerbose()) { - ConsoleInstaller.message("executing: " + command[0] + " " + command[1] - + " " + command[2] + " " + command[3] + " " + command[4]); - } + verboseOutput("executing: " + command[0] + " " + command[1] + " " + command[2] + + " " + command[3] + " " + command[4]); ChildProcess childProcess = new ChildProcess(command, 10000); // 10 seconds childProcess.setDebug(Installation.isVerbose()); int errorCode = childProcess.run(); @@ -278,28 +274,24 @@ } public static boolean isGuiAllowed() { - boolean verbose = isVerbose(); - if (verbose) { - ConsoleInstaller.message("checking gui availability"); - } + verboseOutput("checking gui availability"); if (Boolean.getBoolean(HEADLESS_PROPERTY_NAME)) { + verboseOutput(HEADLESS_PROPERTY_NAME + " is true"); return false; - } - try { - if (verbose) { - ConsoleInstaller.message("trying to get the graphics environment"); - } - GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (verbose) { - ConsoleInstaller.message("got the graphics environment!"); - } - return true; - } catch (Throwable t) { - if (verbose) { - ConsoleInstaller.message("got the following exception:"); - t.printStackTrace(); - } + } else if (GraphicsEnvironment.isHeadless()) { + verboseOutput("GraphicsEnvironment is headless"); return false; + } else { + try { + verboseOutput("trying to get the GraphicsEnvironment"); + GraphicsEnvironment.getLocalGraphicsEnvironment(); + verboseOutput("got the GraphicsEnvironment!"); + return true; + } catch (Throwable t) { + verboseOutput("got the following exception:"); + verboseOutput(t); + return false; + } } } @@ -326,11 +318,8 @@ private static void internalMain(String[] args, Autotest autotest, Tunnel tunnel) { try { setVerbose(InstallerCommandLine.hasVerboseOptionInArgs(args)); - boolean verbose = isVerbose(); - if (verbose) { - dumpSystemProperties(); - ConsoleInstaller.message("reading jar info"); - } + dumpSystemProperties(); + verboseOutput("reading jar info"); JarInfo jarInfo = new JarInfo(); InstallerCommandLine commandLine = new InstallerCommandLine(jarInfo); if (!commandLine.setArgs(args) || commandLine.hasHelpOption()) { @@ -338,9 +327,7 @@ System.exit(1); } else { if (commandLine.hasAutotestOption()) { - if (verbose) { - ConsoleInstaller.message("running autotests"); - } + verboseOutput("running autotests"); _isAutotesting = true; InstallationDriver autotestDriver = new InstallationDriver(commandLine); autotestDriver.drive(); // ! reentrant into internalMain() @@ -349,9 +336,7 @@ System.exit(0); } if (!useGui(commandLine)) { - if (verbose) { - ConsoleInstaller.message("using the console installer"); - } + verboseOutput("using the console installer"); ConsoleInstaller consoleInstaller = new ConsoleInstaller(commandLine, jarInfo); consoleInstaller.setTunnel(tunnel); consoleInstaller.install(); @@ -359,9 +344,7 @@ System.exit(0); } } else { - if (verbose) { - ConsoleInstaller.message("using the gui installer"); - } + verboseOutput("using the gui installer"); new FrameInstaller(commandLine, jarInfo, autotest); } } @@ -375,21 +358,35 @@ } private static void dumpSystemProperties() throws IOException { - @SuppressWarnings("unchecked") - Enumeration<String> names = (Enumeration<String>)System.getProperties().propertyNames(); - StringBuilder contents = new StringBuilder(400); - contents.append("Properties at the beginning of the Jython installation:\n\n"); - while (names.hasMoreElements()) { - String name = names.nextElement(); - String value = System.getProperty(name, ""); - contents.append(name); - contents.append('='); - contents.append(value); - contents.append("\n"); + if (isVerbose()) { + @SuppressWarnings("unchecked") + Enumeration<String> names = (Enumeration<String>)System.getProperties().propertyNames(); + StringBuilder contents = new StringBuilder(400); + contents.append("Properties at the beginning of the Jython installation:\n\n"); + while (names.hasMoreElements()) { + String name = names.nextElement(); + String value = System.getProperty(name, ""); + contents.append(name); + contents.append('='); + contents.append(value); + contents.append("\n"); + } + File output = File.createTempFile("System", ".properties"); + FileHelper.write(output, contents.toString()); + ConsoleInstaller.message("system properties dumped to " + output.getAbsolutePath()); } - File output = File.createTempFile("System", ".properties"); - FileHelper.write(output, contents.toString()); - ConsoleInstaller.message("system properties dumped to " + output.getAbsolutePath()); } + + private static void verboseOutput(String message) { + if (isVerbose()) { + ConsoleInstaller.message(message); + } + } + + private static void verboseOutput(Throwable t) { + if (isVerbose()) { + t.printStackTrace(); + } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |