[Jython-checkins] jython: Improve handling of Jython home directory in launcher.

jeff.allen jython-checkins at python.org
Tue May 23 15:18:22 EDT 2017


https://hg.python.org/jython/rev/6a5e73d57b5b
changeset:   8094:6a5e73d57b5b
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Mon May 22 23:27:07 2017 +0100
summary:
  Improve handling of Jython home directory in launcher.

Fixes regression in launcher that prevents running from bin directory.

files:
  src/shell/jython.exe |  Bin 
  src/shell/jython.py  |    9 +++++++--
  2 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/src/shell/jython.exe b/src/shell/jython.exe
index b7500204c603274a6bdb9ec15064bd27f31c14ac..04305a09cef83132a50cff9383940a0b395c4eb0
GIT binary patch
[stripped]
diff --git a/src/shell/jython.py b/src/shell/jython.py
--- a/src/shell/jython.py
+++ b/src/shell/jython.py
@@ -210,11 +210,16 @@
     def jython_home(self):
         if hasattr(self, "_jython_home"):
             return self._jython_home
-        self._jython_home = get_env("JYTHON_HOME") or os.path.dirname(
-                    os.path.dirname(self.executable))
+        home = get_env("JYTHON_HOME")
+        if home is None:
+            # Not just dirname twice in case dirname(executable) == ''
+            home = os.path.join(os.path.dirname(self.executable), u'..')
+        # This could be a relative path like .\..
+        home = os.path.normpath(home)
         if self.uname == u"cygwin":
             # Even on Cygwin, we need a Windows-style path for this
             home = unicode_subprocess(["cygpath", "--windows", home])
+        self._jython_home = home
         return self._jython_home
 
     @property

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list