Rev 1: A very rough test of JEP (Java Embedded Python) in http://bzr.arbash-meinel.com/branches/bzr/bzrlib_java_test
John Arbash Meinel
john at arbash-meinel.com
Fri Mar 30 17:38:36 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/bzrlib_java_test
------------------------------------------------------------
revno: 1
revision-id: john at arbash-meinel.com-20070330163743-o5qallhstxmkrcj2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bzrlib_java_test
timestamp: Fri 2007-03-30 11:37:43 -0500
message:
A very rough test of JEP (Java Embedded Python)
I can load a python script and run it. Now I need to figure out how
to pass data back and forth between the python code and java code.
added:
.bzrignore bzrignore-20070330163445-d0ehf43mxnx0omt1-1
ImportBzrlibTest.java importbzrlibtest.jav-20070330163449-4vo592rbe92sp2ql-1
Makefile makefile-20070330163449-4vo592rbe92sp2ql-2
test_import.py test_import.py-20070330163449-4vo592rbe92sp2ql-3
-------------- next part --------------
=== added file '.bzrignore'
--- a/.bzrignore 1970-01-01 00:00:00 +0000
+++ b/.bzrignore 2007-03-30 16:37:43 +0000
@@ -0,0 +1,1 @@
+*.class
=== added file 'ImportBzrlibTest.java'
--- a/ImportBzrlibTest.java 1970-01-01 00:00:00 +0000
+++ b/ImportBzrlibTest.java 2007-03-30 16:37:43 +0000
@@ -0,0 +1,35 @@
+import java.io.*;
+
+import jep.*;
+import jep.python.*;
+
+public class ImportBzrlibTest {
+
+ private Jep jep = null;
+
+ public ImportBzrlibTest() {
+ }
+
+ public void run() throws Throwable {
+ System.out.println("Running");
+ File pwd = new File(".");
+
+ this.jep = new Jep(false, pwd.getAbsolutePath());
+ try {
+ jep.runScript("test_import.py");
+ } finally {
+ if (jep != null)
+ jep.close();
+ }
+ }
+
+ public static void main(String args[]) throws Throwable {
+ System.out.println("Hello World");
+
+ ImportBzrlibTest test = new ImportBzrlibTest();
+ test.run();
+ }
+}
+
+
+// vim: ts=8 sw=4 sts=4 tw=79 expandtab autoindent smartindent
=== added file 'Makefile'
--- a/Makefile 1970-01-01 00:00:00 +0000
+++ b/Makefile 2007-03-30 16:37:43 +0000
@@ -0,0 +1,12 @@
+JEP_SRC=$(HOME)/dev/other/jepp/jep/src
+
+.PHONY: all test
+
+all: ImportBzrlibTest.class
+
+test: ImportBzrlibTest.class
+ PYTHONPATH=$(HOME)/dev/bzr/bzr.dev java -classpath .:$(JEP_SRC) ImportBzrlibTest
+
+%.class: %.java
+ javac -sourcepath $(JEP_SRC) $?
+
=== added file 'test_import.py'
--- a/test_import.py 1970-01-01 00:00:00 +0000
+++ b/test_import.py 2007-03-30 16:37:43 +0000
@@ -0,0 +1,5 @@
+import bzrlib.trace
+bzrlib.trace.enable_default_logging()
+bzrlib.trace.note('hello from bzrlib')
+
+value = 'bzrlib is loaded'
More information about the bazaar-commits
mailing list