From: <pj...@us...> - 2008-11-07 01:48:32
|
Revision: 5553 http://jython.svn.sourceforge.net/jython/?rev=5553&view=rev Author: pjenvey Date: 2008-11-07 01:48:27 +0000 (Fri, 07 Nov 2008) Log Message: ----------- fix prefix/exec_prefix/copyright being unicode Modified Paths: -------------- trunk/jython/src/org/python/core/PySystemState.java Modified: trunk/jython/src/org/python/core/PySystemState.java =================================================================== --- trunk/jython/src/org/python/core/PySystemState.java 2008-11-07 01:15:50 UTC (rev 5552) +++ trunk/jython/src/org/python/core/PySystemState.java 2008-11-07 01:48:27 UTC (rev 5553) @@ -3,10 +3,7 @@ import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FilterInputStream; import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.net.URLDecoder; import java.security.AccessControlException; @@ -56,7 +53,7 @@ * The copyright notice for this release. */ // TBD: should we use \u00a9 Unicode c-inside-circle? - public static String copyright = + public static PyObject copyright = Py.newString( "Copyright (c) 2000-2008, Jython Developers\n" + "All rights reserved.\n\n" + @@ -72,7 +69,7 @@ "Copyright (c) 1991-1995 Stichting Mathematisch Centrum, " + "Amsterdam.\n" + - "All Rights Reserved.\n\n"; + "All Rights Reserved.\n\n"); private static Hashtable builtinNames; public static PyTuple builtin_module_names = null; @@ -85,8 +82,8 @@ private static PyObject defaultExecutable; public static Properties registry; // = init_registry(); - public static String prefix; - public static String exec_prefix=""; + public static PyObject prefix; + public static PyObject exec_prefix = Py.EmptyString; private static boolean initialized = false; @@ -446,7 +443,8 @@ } registry = preProperties; - prefix = exec_prefix = findRoot(preProperties, postProperties, jarFileName); + String prefix = findRoot(preProperties, postProperties, jarFileName); + String exec_prefix = prefix; // Load the default registry if (prefix != null) { @@ -461,14 +459,17 @@ } catch (Exception exc) { } } - try { - String jythonpath = System.getenv("JYTHONPATH"); - if (jythonpath != null) - registry.setProperty("python.path", jythonpath); - } catch (SecurityException e) { - } + PySystemState.prefix = Py.newString(prefix); + PySystemState.exec_prefix = Py.newString(exec_prefix); + try { + String jythonpath = System.getenv("JYTHONPATH"); + if (jythonpath != null) { + registry.setProperty("python.path", jythonpath); + } + } catch (SecurityException e) { + } if (postProperties != null) { - registry.putAll(postProperties); + registry.putAll(postProperties); } if (standalone) { // set default standalone property (if not yet set) @@ -625,7 +626,7 @@ } cachedir = new File(props.getProperty(PYTHON_CACHEDIR, CACHEDIR_DEFAULT_NAME)); if (!cachedir.isAbsolute()) { - cachedir = new File(PySystemState.prefix, cachedir.getPath()); + cachedir = new File(prefix.toString(), cachedir.getPath()); } } @@ -727,7 +728,7 @@ PyList path = new PyList(); addPaths(path, props.getProperty("python.path", "")); if (prefix != null) { - String libpath = new File(prefix, "Lib").toString(); + String libpath = new File(prefix.toString(), "Lib").toString(); path.append(new PyString(libpath)); } if (standalone) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |