Barry Warsaw avatar Barry Warsaw committed 64876bb

Two minor changes for better Jython compatibility. Finn Bock says:

Change 1: Not all 'modules' in sys.modules have a
sensible __file__ attribute. Some of our java package
can have the __file__ attribute set to None.

Change 2: In jython we have the jython license file in
<root> and the CPython license file in <root>/Lib. By
reversing the search sequence jython will find and
show the jython license file before the CPython file.

Closes SF patch #405853.

Comments (0)

Files changed (1)

 Unix, it starts with sys.prefix and sys.exec_prefix (if different) and
 appends lib/python<version>/site-packages as well as lib/site-python.
 On other platforms (mainly Mac and Windows), it uses just sys.prefix
-(and sys.exec_prefix, if different, but this is unlikely).  The
+\(and sys.exec_prefix, if different, but this is unlikely).  The
 resulting directories, if they exist, are appended to sys.path, and
 also inspected for path configuration files.
 L = sys.modules.values()
 for m in L:
-    if hasattr(m, "__file__"):
+    if hasattr(m, "__file__") and m.__file__:
         m.__file__ = makepath(m.__file__)
 del m, L
 __builtin__.license = _Printer(
     "license", "See",
     ["LICENSE.txt", "LICENSE"],
-    [here, os.path.join(here, os.pardir), os.curdir])
+    [os.path.join(here, os.pardir), here, os.curdir])
 # Set the string encoding used by the Unicode implementation.  The
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.