Disable workaround for Jython scripts on Linux systems.

--HG--
branch : distribute
extra : rebase_source : 289980b084c335029d93732feb8e02da94472795
parent 753f7831
...@@ -8,6 +8,7 @@ CHANGES ...@@ -8,6 +8,7 @@ CHANGES
* Fix 2 errors with Jython 2.5. * Fix 2 errors with Jython 2.5.
* Fix 1 failure with Jython 2.5 and 2.7. * Fix 1 failure with Jython 2.5 and 2.7.
* Disable workaround for Jython scripts on Linux systems.
------ ------
0.6.32 0.6.32
......
...@@ -1788,6 +1788,11 @@ def chmod(path, mode): ...@@ -1788,6 +1788,11 @@ def chmod(path, mode):
def fix_jython_executable(executable, options): def fix_jython_executable(executable, options):
if sys.platform.startswith('java') and is_sh(executable): if sys.platform.startswith('java') and is_sh(executable):
# Workaround for Jython is not needed on Linux systems.
import java
if java.lang.System.getProperty("os.name") == "Linux":
return executable
# Workaround Jython's sys.executable being a .sh (an invalid # Workaround Jython's sys.executable being a .sh (an invalid
# shebang line interpreter) # shebang line interpreter)
if options: if options:
......
...@@ -561,6 +561,15 @@ class ScriptHeaderTests(TestCase): ...@@ -561,6 +561,15 @@ class ScriptHeaderTests(TestCase):
if (sys.version_info >= (3,) and os.environ.get("LC_CTYPE") if (sys.version_info >= (3,) and os.environ.get("LC_CTYPE")
in (None, "C", "POSIX")): in (None, "C", "POSIX")):
return return
class java:
class lang:
class System:
@staticmethod
def getProperty(property):
return ""
sys.modules["java"] = java
platform = sys.platform platform = sys.platform
sys.platform = 'java1.5.0_13' sys.platform = 'java1.5.0_13'
stdout = sys.stdout stdout = sys.stdout
...@@ -584,6 +593,7 @@ class ScriptHeaderTests(TestCase): ...@@ -584,6 +593,7 @@ class ScriptHeaderTests(TestCase):
'#!%s -x\n' % self.non_ascii_exe) '#!%s -x\n' % self.non_ascii_exe)
self.assertTrue('Unable to adapt shebang line' in sys.stdout.getvalue()) self.assertTrue('Unable to adapt shebang line' in sys.stdout.getvalue())
finally: finally:
del sys.modules["java"]
sys.platform = platform sys.platform = platform
sys.stdout = stdout sys.stdout = stdout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment