Initialize the jython library with the custom lib/jython/ path if we're running as a packaged app on Mac OSX.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@542 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-25 20:05:43 +00:00
parent e28e9ce3cc
commit a734a9c6cb

View File

@ -1,5 +1,6 @@
package com.metaweb.gridworks.expr;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -16,7 +17,20 @@ import org.python.util.PythonInterpreter;
public class JythonEvaluable implements Evaluable {
private static final String s_functionName = "___temp___";
private static PythonInterpreter _engine = new PythonInterpreter();
private static PythonInterpreter _engine;
static {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("mac os x")) {
File libPath = new File("lib/jython");
if (libPath.getAbsolutePath().contains("/Gridworks.app/Contents/Resources/")) {
Properties props = new Properties();
props.setProperty("python.path", libPath.getAbsolutePath());
PythonInterpreter.initialize(System.getProperties(),props, new String[] { "" });
}
}
_engine = new PythonInterpreter();
}
public JythonEvaluable(String s) {
// indent and create a function out of the code