[eclipse-pydev] Patch to allow system jython interpreter to be configured in preferences

Mat Booth mbooth at fedoraproject.org
Thu Jun 5 12:01:03 UTC 2014


commit 9dcbecefad239142fc011243ac119d49f1ecd34b
Author: Mat Booth <mat.booth at redhat.com>
Date:   Wed Jun 4 17:40:37 2014 +0100

    Patch to allow system jython interpreter to be configured in preferences

 eclipse-pydev.spec              |    9 +++++-
 system-jython-interpreter.patch |   57 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/eclipse-pydev.spec b/eclipse-pydev.spec
index 8c52adb..b79f8c8 100644
--- a/eclipse-pydev.spec
+++ b/eclipse-pydev.spec
@@ -7,7 +7,7 @@ Epoch: 1
 Summary: Eclipse Python development plug-in
 Name:    eclipse-pydev
 Version:          3.5.0
-Release:          2%{?dist}
+Release:          3%{?dist}
 License:          EPL
 URL:              http://pydev.org
 
@@ -21,6 +21,9 @@ Patch2:           remove-iInfo-error.patch
 # Allow building with the latest version of jython in Fedora
 Patch3:           jython-build.patch
 
+# Allow system jython interpreter to be configured in preferences
+Patch4:           system-jython-interpreter.patch
+
 BuildRequires:    java-devel >= 1.7.0
 BuildArch:        noarch
 
@@ -75,6 +78,7 @@ Mylyn Task-Focused UI extensions for Pydev.
 %patch1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 #fix mylyn plugin version
 sed --in-place 's:libs/,\\:libs/:' plugins/org.python.pydev/build.properties 
@@ -193,6 +197,9 @@ rm -f  %{_datadir}/jython/Lib/optparse.py
 %{install_loc}/pydev-mylyn
 
 %changelog
+* Wed Jun 04 2014 Mat Booth <mat.booth at redhat.com> - 1:3.5.0-3
+- Patch to allow system jython interpreter to be configured in preferences
+
 * Mon Jun 02 2014 Mat Booth <mat.booth at redhat.com> - 1:3.5.0-2
 - Patch to build with latest version of jython
 - Install license files
diff --git a/system-jython-interpreter.patch b/system-jython-interpreter.patch
new file mode 100644
index 0000000..bb48751
--- /dev/null
+++ b/system-jython-interpreter.patch
@@ -0,0 +1,57 @@
+diff --git a/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java b/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
+index 1b3d84c..3347fe4 100644
+--- a/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
++++ b/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
+@@ -74,19 +74,24 @@ public class SimpleJythonRunner extends SimpleRunner {
+             String javaLoc = javaExecutable.getCanonicalPath();
+             String[] s;
+ 
+-            //In Jython 2.5b0, if we don't set python.home, it won't be able to calculate the correct PYTHONPATH
+-            //(see http://bugs.jython.org/issue1214 )
+-
+-            String pythonHome = new File(jythonJar).getParent().toString();
+-
+-            if (additionalPythonpath != null) {
+-                jythonJar += SimpleRunner.getPythonPathSeparator();
+-                jythonJar += additionalPythonpath;
+-                s = new String[] { javaLoc, "-Dpython.path=" + additionalPythonpath, "-Dpython.home=" + pythonHome,
+-                        "-classpath", jythonJar, "org.python.util.jython", script };
++            if (new File(jythonJar).getName().equals("jython")) {
++                //The system jython can simply be invoked directly
++                s = new String[] { jythonJar, script };
+             } else {
+-                s = new String[] { javaLoc, "-Dpython.home=" + pythonHome, "-classpath", jythonJar,
+-                        "org.python.util.jython", script };
++                //In Jython 2.5b0, if we don't set python.home, it won't be able to calculate the correct PYTHONPATH
++                //(see http://bugs.jython.org/issue1214 )
++
++                String pythonHome = new File(jythonJar).getParent().toString();
++
++                if (additionalPythonpath != null) {
++                    jythonJar += SimpleRunner.getPythonPathSeparator();
++                    jythonJar += additionalPythonpath;
++                    s = new String[] { javaLoc, "-Dpython.path=" + additionalPythonpath, "-Dpython.home=" + pythonHome,
++                            "-classpath", jythonJar, "org.python.util.jython", script };
++                } else {
++                    s = new String[] { javaLoc, "-Dpython.home=" + pythonHome, "-classpath", jythonJar,
++                            "org.python.util.jython", script };
++                }
+             }
+ 
+             if (args != null && args.length > 0) {
+diff --git a/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java b/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
+index cd9d921..6ab5ccc 100644
+--- a/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
++++ b/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
+@@ -1436,9 +1436,9 @@ public class InterpreterInfo implements IInterpreterInfo {
+      */
+     public static boolean isJythonExecutable(String executable) {
+         if (executable.endsWith("\"")) {
+-            return executable.endsWith(".jar\"");
++            return executable.endsWith(".jar\"") || executable.endsWith("jython\"");
+         }
+-        return executable.endsWith(".jar");
++        return executable.endsWith(".jar") || executable.endsWith("jython");
+     }
+ 
+     /**


More information about the scm-commits mailing list