lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1142290 - in /lucene/pylucene/trunk/jcc: java/org/apache/jcc/PythonVM.java setup.py
Date Sat, 02 Jul 2011 20:21:14 GMT
Author: vajda
Date: Sat Jul  2 20:21:13 2011
New Revision: 1142290

URL: http://svn.apache.org/viewvc?rev=1142290&view=rev
Log:
added javadoc for org.apache.jcc.PythonBVM class (Bill Janssen)

Modified:
    lucene/pylucene/trunk/jcc/java/org/apache/jcc/PythonVM.java
    lucene/pylucene/trunk/jcc/setup.py

Modified: lucene/pylucene/trunk/jcc/java/org/apache/jcc/PythonVM.java
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/java/org/apache/jcc/PythonVM.java?rev=1142290&r1=1142289&r2=1142290&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/java/org/apache/jcc/PythonVM.java (original)
+++ lucene/pylucene/trunk/jcc/java/org/apache/jcc/PythonVM.java Sat Jul  2 20:21:13 2011
@@ -23,6 +23,18 @@ public class PythonVM {
         System.loadLibrary("jcc");
     }
 
+    /**
+     * Start the embedded Python interpreter.  The specified
+     * program name and args are set into the Python variable sys.argv.
+     * This returns an instance of the Python VM; it may be called
+     * multiple times, and will return the same VM instance each time.
+     *
+     * @param programName the name of the Python program, typically
+     * /usr/bin/python.  This is informational; the program is not
+     * actually executed.
+     * @param args additional arguments to be put into sys.argv.
+     * @return a singleton instance of PythonVM
+     */
     static public PythonVM start(String programName, String[] args)
     {
         if (vm == null)
@@ -34,11 +46,28 @@ public class PythonVM {
         return vm;
     }
 
+    /**
+     * Start the embedded Python interpreter.  The specified
+     * program name is set into the Python variable sys.argv[0].
+     * This returns an instance of the Python VM; it may be called
+     * multiple times, and will return the same VM instance each time.
+     *
+     * @param programName the name of the Python program, typically
+     * /usr/bin/python.  This is informational; the program is not
+     * actually executed.
+     * @return a singleton instance of PythonVM
+     */
     static public PythonVM start(String programName)
     {
         return start(programName, null);
     }
 
+    /**
+     * Obtain the PythonVM instance, or null if the Python VM
+     * has not yet been started.
+     *
+     * @return a singleton instance of PythonVM, or null
+     */
     static public PythonVM get()
     {
         return vm;
@@ -50,9 +79,34 @@ public class PythonVM {
 
     protected native void init(String programName, String[] args);
 
+    /**
+     * Instantiate the specified Python class, and return the instance.
+     *
+     * @param moduleName the Python module the class is defined in
+     * @param className the Python class to instantiate.
+     * @return a handle on the Python instance.
+     */
     public native Object instantiate(String moduleName, String className)
         throws PythonException;
 
+    /**
+     * Bump the Python thread state counter.  Every thread should
+     * do this before calling into Python, to prevent the Python
+     * thread state from being inadvertently collected (and causing loss
+     * of thread-local variables)
+     *
+     * @return the Python thread state counter.  A return value less
+     * than zero signals an error.
+     */
     public native int acquireThreadState();
+
+    /**
+     * Release the Python thread state counter.  Every thread that has
+     * called acquireThreadState() should call this before
+     * terminating.
+     *
+     * @return the Python thread state counter.  A return value less
+     * than zero signals an error.
+     */
     public native int releaseThreadState();
 }

Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=1142290&r1=1142289&r2=1142290&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Sat Jul  2 20:21:13 2011
@@ -157,7 +157,16 @@ JAVAC = {
     'mingw32': ['%(mingw32)s/bin/javac.exe' %(JDK)],
     'freebsd7': ['javac'],
 }
-        
+
+JAVADOC = {
+    'darwin': ['javadoc'],
+    'ipod': [],
+    'linux2': ['javadoc'],
+    'sunos5': ['javadoc'],
+    'win32': ['%(win32)s/bin/javadoc.exe' %(JDK)],
+    'mingw32': ['%(mingw32)s/bin/javadoc.exe' %(JDK)],
+    'freebsd7': ['javadoc'],
+}
 
 try:
     if 'USE_DISTUTILS' in os.environ:
@@ -165,7 +174,7 @@ try:
     from setuptools import setup, Extension
     from pkg_resources import require
     with_setuptools = require('setuptools')[0].parsed_version
-    
+
     enable_shared = False
     with_setuptools_c7 = ('00000000', '00000006', '*c', '00000007', '*final')
 
@@ -226,6 +235,11 @@ def main(debug):
     else:
         _javac = JAVAC[platform]
 
+    if 'JCC_JAVADOC' in os.environ:
+        _javadoc = os.environ['JCC_JAVADOC'].split(_jcc_argsep)
+    else:
+        _javadoc = JAVADOC[platform]
+
     from helpers.build import jcc_build_py
 
     jcc_build_py.config_file = \
@@ -317,6 +331,16 @@ def main(debug):
         package_data.append('classes/org/apache/jcc/PythonVM.class')
         package_data.append('classes/org/apache/jcc/PythonException.class')
 
+        args = _javadoc[:]
+        args.extend(('-d', 'javadoc', '-sourcepath', 'java', 'org.apache.jcc'))
+        try:
+            process = Popen(args, stderr=PIPE)
+        except Exception, e:
+            raise type(e), "%s: %s" %(e, args)
+        process.wait()
+        if process.returncode != 0:
+            raise OSError, process.stderr.read()
+
     extensions.append(Extension('jcc._jcc',
                                 extra_compile_args=cflags,
                                 extra_link_args=lflags,



Mime
View raw message