Rev 3: If I directly write to sys.stdout or use 'print' it works. in http://bzr.arbash-meinel.com/branches/bzr/bzrlib_java_test

John Arbash Meinel john at arbash-meinel.com
Fri Mar 30 18:01:27 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/bzrlib_java_test

------------------------------------------------------------
revno: 3
revision-id: john at arbash-meinel.com-20070330170126-pm6jbxvamdqp8tf5
parent: john at arbash-meinel.com-20070330165351-0ng92k4gz0auhwap
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bzrlib_java_test
timestamp: Fri 2007-03-30 12:01:26 -0500
message:
  If I directly write to sys.stdout or use 'print' it works.
  So I need to figure out why bzrlib.trace.note() is failing.
added:
  bzrlib_wrapper.py              bzrlib_wrapper.py-20070330170106-i5zfzn47ohmyae79-1
  print_tester.py                print_tester.py-20070330170106-i5zfzn47ohmyae79-2
modified:
  ImportBzrlibTest.java          importbzrlibtest.jav-20070330163449-4vo592rbe92sp2ql-1
-------------- next part --------------
=== added file 'bzrlib_wrapper.py'
--- a/bzrlib_wrapper.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib_wrapper.py	2007-03-30 17:01:26 +0000
@@ -0,0 +1,28 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""A wrapper around bzrlib to make sure things are accessible."""
+
+import jep
+
+import java.lang
+import java.util
+import java.io
+
+import bzrlib.branch
+import bzrlib.trace
+import bzrlib.workingtree
+

=== added file 'print_tester.py'
--- a/print_tester.py	1970-01-01 00:00:00 +0000
+++ b/print_tester.py	2007-03-30 17:01:26 +0000
@@ -0,0 +1,29 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Some simple tests for file io"""
+
+import sys
+
+
+def just_print(obj):
+    """Just print out an object passed in."""
+    print 'Printing: %s' % (obj,)
+
+
+def write_to_stdout(obj):
+    """Use sys.stdout.write for different effect."""
+    sys.stdout.write('Writing to sys.stdout: %s\n' % (obj,))

=== modified file 'ImportBzrlibTest.java'
--- a/ImportBzrlibTest.java	2007-03-30 16:53:51 +0000
+++ b/ImportBzrlibTest.java	2007-03-30 17:01:26 +0000
@@ -1,3 +1,19 @@
+// Copyright (C) 2007 Canonical Ltd
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
 import java.io.*;
 
 import jep.*;
@@ -28,18 +44,9 @@
 
         this.jep = new Jep(false, pwd.getAbsolutePath());
         try {
-            load_and_enable_bzrlib();
-            // These doesn't seem to do anything. They also don't claim to
-            // fail....
-            jep.invoke("bzrlib.trace.note", "Who are you?");
-            jep.invoke("bzrlib.trace.note", "And what have you done with: %s",
-                        "me");
-
-            Object a_branch =
-                jep.invoke("bzrlib.workingtree.WorkingTree.open_containing",
-                           "/");
-
-            System.out.println("a_branch: " + a_branch);
+            jep.runScript("print_tester.py");
+            jep.invoke("just_print", "test_str");
+            jep.invoke("write_to_stdout", "test_str");
         } finally {
             if (jep != null)
                 jep.close();



More information about the bazaar-commits mailing list