You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/03/15 10:20:10 UTC
svn commit: r637375 -
/incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
Author: antelder
Date: Sat Mar 15 02:20:08 2008
New Revision: 637375
URL: http://svn.apache.org/viewvc?rev=637375&view=rev
Log:
TUSCANY-1950, try to avoid the jython *sys-package-mgr* messages
Modified:
incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
Modified: incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java?rev=637375&r1=637374&r2=637375&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java Sat Mar 15 02:20:08 2008
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.implementation.script;
+import java.io.File;
+import java.io.IOException;
import java.io.StringReader;
import javax.script.Invocable;
@@ -141,7 +143,26 @@
if ("rb".equals(scriptExtn)) {
return new TuscanyJRubyScriptEngine();
} else {
+ if ("py".equals(scriptExtn)) {
+ pythonCachedir();
+ }
return scriptEngineManager.getEngineByExtension(scriptExtn);
+ }
+ }
+
+ /**
+ * If the cachedir or python home properties are not set then create a temp folder for cachedir
+ * See TUSCANY-1950
+ */
+ protected void pythonCachedir() {
+ try {
+ if (System.getProperty("python.cachedir") == null || System.getProperty("python.home") == null) {
+ File cachedir = new File(File.createTempFile("tuscany", "sca").getParentFile(), "tuscany.python.cachedir");
+ cachedir.mkdir();
+ System.setProperty("python.cachedir", cachedir.getCanonicalPath());
+ }
+ } catch (IOException e) {
+ // ignore
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org