Update of /cvsroot/jython/jython/org/python/util
In directory slayer.i.sourceforge.net:/tmp/cvs-serv2046
Modified Files:
jython.java
Log Message:
main(): Only print the 'Type "copyright", ...' line when importing site
and the "copyright", "credits" or "license" strings actually exists in
the builtins. This also works when using -S or using a site.py from
CPython 1.5.2
Index: jython.java
===================================================================
RCS file: /cvsroot/jython/jython/org/python/util/jython.java,v
retrieving revision 2.14
retrieving revision 2.15
diff -C2 -r2.14 -r2.15
*** jython.java 2000/10/16 18:34:09 2.14
--- jython.java 2000/12/06 21:04:30 2.15
***************
*** 96,102 ****
--- 96,126 ----
//System.err.println("imp");
+ String msg = "";
if (Options.importSite) {
try {
imp.load("site");
+
+ if (opts.notice) {
+ PyObject builtins = Py.getSystemState().builtins;
+ boolean copyright = builtins.__finditem__("copyright") != null;
+ boolean credits = builtins.__finditem__("credits") != null;
+ boolean license = builtins.__finditem__("license") != null;
+ if (copyright) {
+ msg += "\"copyright\"";
+ if (credits && license)
+ msg += ", ";
+ else if (credits || license)
+ msg += " or ";
+ }
+ if (credits) {
+ msg += "\"credits\"";
+ if (license)
+ msg += " or ";
+ }
+ if (license)
+ msg += "\"license\"";
+ if (msg.length() > 0)
+ System.err.println("Type " + msg + " for more information.");
+ }
} catch (PyException pye) {
if (!Py.matchException(pye, Py.ImportError)) {
|