From: <pj...@us...> - 2009-04-07 01:49:36
|
Revision: 6180 http://jython.svn.sourceforge.net/jython/?rev=6180&view=rev Author: pjenvey Date: 2009-04-07 01:49:15 +0000 (Tue, 07 Apr 2009) Log Message: ----------- shadow sys.platform 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 2009-04-07 00:37:45 UTC (rev 6179) +++ trunk/jython/src/org/python/core/PySystemState.java 2009-04-07 01:49:15 UTC (rev 6180) @@ -93,7 +93,6 @@ public static Properties registry; // = init_registry(); public static PyObject prefix; public static PyObject exec_prefix = Py.EmptyString; - public static PyString platform = new PyString("java"); public static final PyString byteorder = new PyString("big"); public static final int maxint = Integer.MAX_VALUE; @@ -110,6 +109,7 @@ // shadowed statics - don't use directly public static PyList warnoptions = new PyList(); public static PyObject builtins; + public static PyObject platform = new PyString("java"); public PyList meta_path; public PyList path_hooks; @@ -197,7 +197,6 @@ name == "__class__" || name == "registry" || name == "exec_prefix" || - name == "platform" || name == "packageManager") { throw Py.TypeError("readonly attribute"); } @@ -242,8 +241,7 @@ public synchronized PyObject getBuiltins() { if (shadowing == null) { return getDefaultBuiltins(); - } - else { + } else { return shadowing.builtins; } } @@ -260,8 +258,7 @@ public synchronized PyObject getWarnoptions() { if (shadowing == null) { return warnoptions; - } - else { + } else { return shadowing.warnoptions; } } @@ -274,6 +271,22 @@ } } + public synchronized PyObject getPlatform() { + if (shadowing == null) { + return platform; + } else { + return shadowing.platform; + } + } + + public synchronized void setPlatform(PyObject value) { + if (shadowing == null) { + platform = value; + } else { + shadowing.platform = value; + } + } + // xxx fix this accessors public PyObject __findattr_ex__(String name) { if (name == "exc_value") { @@ -298,6 +311,8 @@ return getWarnoptions(); } else if (name == "builtins") { return getBuiltins(); + } else if (name == "platform") { + return getPlatform(); } else { PyObject ret = super.__findattr_ex__(name); if (ret != null) { @@ -321,10 +336,12 @@ if (name == "builtins") { shadow(); setBuiltins(value); - } - else if (name == "warnoptions") { + } else if (name == "warnoptions") { shadow(); setWarnoptions(value); + } else if (name == "platform") { + shadow(); + setPlatform(value); } else { PyObject ret = getType().lookup(name); // xxx fix fix fix if (ret != null && ret._doset(this, value)) { @@ -1228,9 +1245,11 @@ class Shadow { PyObject builtins; PyList warnoptions; + PyObject platform; Shadow() { builtins = PySystemState.getDefaultBuiltins(); warnoptions = PySystemState.warnoptions; + platform = PySystemState.platform; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |