Set python.path properly from within the jython extension

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1920 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-11-21 03:05:28 +00:00
parent 1e2af79851
commit d5a742944e
3 changed files with 11 additions and 14 deletions

View File

@ -32,7 +32,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
function init() { function init() {
// Packages.java.lang.System.err.println("Initializing jython extension"); var libPath = new Packages.java.io.File(module.getPath(), "MOD-INF/lib/jython/").getCanonicalPath();
var S = Packages.java.lang.System;
var currentLibPath = S.getProperty("python.path");
if (currentLibPath == null) {
currentLibPath = libPath;
} else if (currentLibPath.indexOf(libPath) < 0) {
currentLibPath = currentLibPath + Packages.java.io.File.pathSeparator + libPath;
}
S.setProperty("python.path", currentLibPath);
Packages.com.google.refine.expr.MetaParser.registerLanguageParser( Packages.com.google.refine.expr.MetaParser.registerLanguageParser(
"jython", "jython",

7
refine
View File

@ -910,13 +910,6 @@ if [ -z "$REFINE_VERBOSITY" ] ; then
fi fi
add_option "-Drefine.verbosity=$REFINE_VERBOSITY" add_option "-Drefine.verbosity=$REFINE_VERBOSITY"
if [ -z "$JYTHONPATH" ] ; then
JYTHONPATH="$REFINE_WEBAPP/WEB-INF/lib/jython"
else
JYTHONPATH="$REFINE_WEBAPP/WEB-INF/lib/jython${SEP}$JYTHONPATH"
fi
add_option "-Dpython.path=$JYTHONPATH"
# ----- Respond to the action given -------------------------------------------- # ----- Respond to the action given --------------------------------------------
case "$ACTION" in case "$ACTION" in

View File

@ -95,11 +95,6 @@ public class Refine {
// tell the signpost library to log // tell the signpost library to log
//System.setProperty("debug","true"); //System.setProperty("debug","true");
// if not already set, make sure jython can find its python stuff
if (System.getProperty("python.path") == null) {
System.setProperty("python.path","lib/python");
}
// set the log verbosity level // set the log verbosity level
org.apache.log4j.Logger.getRootLogger().setLevel(Level.toLevel(Configurations.get("refine.verbosity","info"))); org.apache.log4j.Logger.getRootLogger().setLevel(Level.toLevel(Configurations.get("refine.verbosity","info")));