You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2009/05/23 01:49:42 UTC

svn commit: r777745 - in /lucene/pylucene/tags/pylucene_2_4_1: ./ jcc/ jcc/jcc/ jcc/jcc/sources/

Author: vajda
Date: Fri May 22 23:49:42 2009
New Revision: 777745

URL: http://svn.apache.org/viewvc?rev=777745&view=rev
Log:
moved pylucene_2_4_1 tag to head of pylucene_2_4 branch

Added:
    lucene/pylucene/tags/pylucene_2_4_1/extensions.xml
      - copied unchanged from r777744, lucene/pylucene/branches/pylucene_2_4/extensions.xml
Removed:
    lucene/pylucene/tags/pylucene_2_4_1/build.xml
Modified:
    lucene/pylucene/tags/pylucene_2_4_1/CHANGES
    lucene/pylucene/tags/pylucene_2_4_1/Makefile
    lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES
    lucene/pylucene/tags/pylucene_2_4_1/jcc/DESCRIPTION
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/__main__.py
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/cpp.py
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/python.py
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.cpp
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.h
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/jcc.cpp
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/macros.h
    lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/types.cpp
    lucene/pylucene/tags/pylucene_2_4_1/jcc/setup.py

Modified: lucene/pylucene/tags/pylucene_2_4_1/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/CHANGES?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/CHANGES (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/CHANGES Fri May 22 23:49:42 2009
@@ -1,4 +1,11 @@
 
+Version 2.4.1 ->
+----------------------
+ - renamed the Highlighter's SpanScorer class to HighlighterSpanScorer
+ - fixed bug in Makefile's test target which tested installed build
+ - PyLucene built with JCC 2.3
+ - 
+
 Version 2.4.0 -> 2.4.1
 ----------------------
  - PyLucene with JCC now a subproject of the Apache Lucene project

Modified: lucene/pylucene/tags/pylucene_2_4_1/Makefile
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/Makefile?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/Makefile (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/Makefile Fri May 22 23:49:42 2009
@@ -14,7 +14,7 @@
 # site-packages directory.
 #
 
-VERSION=2.4.1-rc7
+VERSION=2.4.1-2
 LUCENE_SVN_VER=HEAD
 LUCENE_VER=2.4.1
 LUCENE_SVN=http://svn.apache.org/repos/asf/lucene/java/tags/lucene_2_4_1
@@ -30,6 +30,8 @@
 # PREFIX: where programs are normally installed on your system (Unix).
 # PREFIX_PYTHON: where your version of python is installed.
 # JCC: how jcc is invoked, depending on the python version:
+#  - python 2.6:
+#      $(PYTHON) -m jcc.__main__
 #  - python 2.5:
 #      $(PYTHON) -m jcc
 #  - python 2.4:
@@ -46,8 +48,8 @@
 #JCC=$(PYTHON) -m jcc --shared
 #NUM_FILES=2
 
-# Mac OS X  (Python 2.6, Java 1.5)
-#PREFIX_PYTHON=/Users/vajda/tmp/Python-2.6/install
+# Mac OS X  (Python 2.6.2, Java 1.5)
+#PREFIX_PYTHON=/Users/vajda/tmp/Python-2.6.2/install
 #ANT=ant
 #PYTHON=$(PREFIX_PYTHON)/Python.framework/Versions/2.6/bin/python
 #JCC=$(PYTHON) -m jcc.__main__ --shared
@@ -57,14 +59,14 @@
 #PREFIX_PYTHON=/usr
 #ANT=ant
 #PYTHON=$(PREFIX_PYTHON)/bin/python
-#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.2-py2.3-macosx-10.4-i386.egg/jcc/__init__.py
+#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.3-py2.3-macosx-10.4-i386.egg/jcc/__init__.py
 #NUM_FILES=2
 
 # Mac OS X  (Python 2.3.5, Java 1.5, setuptools 0.6c7, PPC Mac OS X 10.4)
 #PREFIX_PYTHON=/usr
 #ANT=ant
 #PYTHON=$(PREFIX_PYTHON)/bin/python
-#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.2-py2.3-macosx-10.4-ppc.egg/jcc/__init__.py
+#JCC=$(PYTHON) /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/JCC-2.3-py2.3-macosx-10.4-ppc.egg/jcc/__init__.py
 #NUM_FILES=2
 
 # Linux     (Ubuntu 6.06, Python 2.4, Java 1.5, no setuptools)
@@ -168,7 +170,7 @@
 	cd $(LUCENE)/contrib/instantiated; $(ANT) -Dversion=$(LUCENE_VER)
 
 $(EXTENSIONS_JAR): $(LUCENE_JAR)
-	$(ANT) -Dlucene.dir=$(LUCENE)
+	$(ANT) -f extensions.xml -Dlucene.dir=$(LUCENE)
 
 JARS=$(LUCENE_JAR) $(SNOWBALL_JAR) $(HIGHLIGHTER_JAR) $(ANALYZERS_JAR) \
      $(REGEX_JAR) $(QUERIES_JAR) $(INSTANTIATED_JAR) $(EXTENSIONS_JAR)
@@ -193,6 +195,7 @@
            --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' \
            --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' \
            --sequence org.apache.lucene.search.Hits 'length:()I' 'doc:(I)Lorg/apache/lucene/document/Document;' \
+           --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer \
            --version $(LUCENE_VER) \
            --module python/collections.py \
            --files $(NUM_FILES)
@@ -220,12 +223,22 @@
 	rm -rf $(LUCENE)
 
 
+BUILD_TEST:=$(PYLUCENE)/build/test
+
+ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
+BUILD_TEST:=`cygpath -aw $(BUILD_TEST)`
+endif
+
+install-test:
+	mkdir -p $(BUILD_TEST)
+	PYTHONPATH=$(BUILD_TEST) $(GENERATE) --install $(DEBUG_OPT) --install-dir $(BUILD_TEST)
+
 samples/LuceneInAction/index:
-	cd samples/LuceneInAction; $(PYTHON) index.py
+	cd samples/LuceneInAction; PYTHONPATH=$(BUILD_TEST) $(PYTHON) index.py
 
-test: samples/LuceneInAction/index
-	find test -name 'test_*.py' | xargs -t -n 1 $(PYTHON)
-	ls samples/LuceneInAction/*Test.py | xargs -t -n 1 $(PYTHON)
+test: install-test samples/LuceneInAction/index
+	find test -name 'test_*.py' | PYTHONPATH=$(BUILD_TEST) xargs -t -n 1 $(PYTHON)
+	ls samples/LuceneInAction/*Test.py | PYTHONPATH=$(BUILD_TEST) xargs -t -n 1 $(PYTHON)
 
 
 ARCHIVE=pylucene-$(VERSION)-src.tar.gz
@@ -243,3 +256,7 @@
 stage:
 	cd distrib; scp -p $(ARCHIVE) $(ARCHIVE).asc $(ARCHIVE).md5 \
                            people.apache.org:public_html/staging_area
+
+release:
+	cd distrib; scp -p $(ARCHIVE) $(ARCHIVE).asc $(ARCHIVE).md5 \
+                           people.apache.org:/www/www.apache.org/dist/lucene/pylucene

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES Fri May 22 23:49:42 2009
@@ -1,4 +1,15 @@
 
+Version 2.2 -> 2.3
+------------------
+ - fixed Solaris compilation issue with using va_arg() with function pointers
+ - added --reserved command line arg to extend list of words to mangle
+ - fixed bug with initJCC not being run when Python VM embedded in JVM
+ - added --wininst to enable use of bdist_wininst with distutils (Jonas Maurus)
+ - added --help to describe command line options (Jonas Maurus)
+ - added support for --rename to workaround python flattened namespace clashes
+ - fixed bug with Enumeration/Iterator template function instantiation
+ - removed -framework Python from darwin link flags in setup.py
+
 Version 2.1 -> 2.2
 ------------------
  - JCC now a subproject of the Apache PyLucene project

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/DESCRIPTION
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/DESCRIPTION?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/DESCRIPTION (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/DESCRIPTION Fri May 22 23:49:42 2009
@@ -1,8 +1,8 @@
 
 For changes since earlier releases, see:
-  http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/CHANGES
+  http://svn.apache.org/repos/asf/lucene/pylucene/tags/pylucene_2_4_1/jcc/CHANGES
 
-JCC is a C++ code generator for producing the glue code necessary to call
+JCC is a C++ code generator for producing the code necessary to call
 into Java classes from CPython via Java's Native Invocation Interface (JNI).
 
 JCC generates C++ wrapper classes that hide all the gory details of JNI
@@ -17,9 +17,7 @@
 various Java Runtime Environments such as Sun Java 1.4, 1.5 and 1.6, Apple's
 Java 1.4 and 1.5 on Mac OS X and open source Java OpenJDK 1.7 builds.
 
-JCC is known to work on Intel and PowerPC Mac OS X 10.3, 10.4 and 10.5,
-Ubuntu Linux Dapper, Feisty and Gutsy, Sun Solaris Express, Windows 2000 and
-Windows XP.
+JCC is supported on Mac OS X, Linux, Solaris and Windows.
 
 JCC is written in C++ and Python. It uses Java's reflection API to do its
 job and needs a Java Runtime Environment to be present to operate.
@@ -37,11 +35,10 @@
 and libraries.
 
 The svn sources for JCC are available at:
-  http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/
+  http://svn.apache.org/repos/asf/lucene/pylucene/tags/pylucene_2_4_1/jcc/
 
 For more information about JCC see:
-  http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/README 
-  http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/INSTALL
+  http://lucene.apache.org/pylucene/jcc/index.html
 
 JCC comes with an Apache 2.0 copyright license:
   http://www.apache.org/licenses/LICENSE-2.0

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/__main__.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/__main__.py?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/__main__.py (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/__main__.py Fri May 22 23:49:42 2009
@@ -1,5 +1,82 @@
 
 import sys
-
 from jcc import cpp
+
+if len(sys.argv) == 1 or '--help' in sys.argv:
+    help = '''
+  JCC - C++/Python Java Native Interface Code Generator
+
+  Usage: python -m jcc.__main__ [options] [actions]
+
+  Input options:
+    --jar JARFILE           - make JCC wrap all public classes found in
+                              JARFILE, add it to the module's CLASSPATH and
+                              include it in the distribution 
+    --include JARFILE       - include JARFILE in the distribution and add
+                              it to the module's CLASSPATH
+    --exclude CLASS         - explicitly don't wrap CLASS
+    --package PACKAGE       - add PACKAGE to the list of packages from
+                              which dependencies are automatically wrapped
+    --classpath [PATH|JAR]  - add [PATH|JAR] to CLASSPATH while generating
+                              wrappers 
+    --module MODULE         - include Python MODULE in the distribution
+    --reserved SYMBOL       - mark SYMBOL as a reserved word that will be
+                              mangled in the generated C++ code to avoid
+                              clashes with C/C++ reserved words or header
+                              file definitions
+
+  Python wrapper generation options:
+    --python NAME           - generate wrappers for use from Python in a module
+                              called NAME
+    --version VERSION       - the generated module's version number
+    --shared                - generate a module that links against a shared
+                              library version of the JCC runtime so that
+                              multiple JCC-wrapped modules can be used within
+                              the same Python runtime
+    --sequence CLASS METHODSIGNATURE
+                            - Generate a pythonic sequence protocol wrapper for
+                              CLASS
+    --mapping CLASS METHODSIGNATURE1 METHODSIGNATURE2
+                            - Generate a pythonic map protocol wrapper for CLASS
+
+    --rename CLASS1=NAME1,CLASS2=NAME2,...
+                            - Rename one or more Python wrapper classes to
+                              avoid name clashes due to the flattening of
+                              the Java package namespaces as mapped into
+                              Python
+
+    If you're planning to use pythonic wrappers you should read the relevant
+    documentation first:
+      http://lucene.apache.org/pylucene/jcc/documentation/readme.html#python
+
+  Output options:
+    --debug                 - generate a module using the C++ compiler's
+                              debug options
+    --output OUTPUTDIR      - the wrapper will be generated in OUTPUTDIR,
+                              'build' by default
+    --files N               - split the generated wrapper file into at least
+                              N files to workaround C++ compiler file size
+                              limitations 
+
+  Actions:
+    --build                 - generate the wrapper and compile it
+    --compile               - recompile the (previously generated) module
+    --install               - install the wrapper in the local site-packages
+
+  Distribution actions:
+    --use-distutils         - use distutils even when setuptools is availble
+    --bdist                 - generate a binary distutils-based distribution
+                              or a setuptools-based .egg
+    --wininst               - create an installer application for Microsoft
+                              Windows
+
+  Other distutils/setuptools options (there are passed right through):
+    --compiler COMPILER     - use COMPILER instead of the platform default
+    --root ROOTDIR
+    --install-dir INSTALLDIR
+    --prefix PREFIX
+'''
+    print help
+    sys.exit(0)
+  
 cpp.jcc(sys.argv)

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/cpp.py?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/cpp.py Fri May 22 23:49:42 2009
@@ -257,6 +257,7 @@
     version = ''
     mappings = {}
     sequences = {}
+    renames = {}
     env = None
     wrapperFiles = 1
     prefix = None
@@ -265,6 +266,7 @@
     use_distutils = False
     shared = False
     dist = False
+    wininst = False
     compiler = None
 
     i = 1
@@ -319,6 +321,10 @@
             elif arg == '--sequence':
                 sequences[args[i + 1]] = (args[i + 2], args[i + 3])
                 i += 3
+            elif arg == '--rename':
+                i += 1
+                renames.update(dict([arg.split('=')
+                                     for arg in args[i].split(',')]))
             elif arg == '--files':
                 i += 1
                 wrapperFiles = args[i]
@@ -340,9 +346,16 @@
             elif arg == '--bdist':
                 from python import compile
                 dist = True
+            elif arg == '--wininst':
+                from python import compile
+                wininst = True
+                dist = True
             elif arg == '--compiler':
                 i += 1
                 compiler = args[i]
+            elif arg == '--reserved':
+                i += 1
+                RESERVED.update(args[i].split(','))
             else:
                 raise ValueError, "Invalid argument: %s" %(arg)
         else:
@@ -363,7 +376,7 @@
             compile(env, os.path.dirname(args[0]), output, moduleName,
                     install, dist, debug, jars, version,
                     prefix, root, install_dir, use_distutils,
-                    shared, compiler, modules)
+                    shared, compiler, modules, wininst)
     else:
         for className in classNames:
             cls = findClass(className.replace('.', '/'))
@@ -444,6 +457,7 @@
                            constructors, methods, protectedMethods,
                            fields, instanceFields,
                            mappings.get(className), sequences.get(className),
+                           renames.get(className),
                            declares, typeset, excludes, moduleName)
 
                 line(out_h)
@@ -474,7 +488,7 @@
                 compile(env, os.path.dirname(args[0]), output, moduleName,
                         install, dist, debug, jars, version,
                         prefix, root, install_dir, use_distutils,
-                        shared, compiler, modules)
+                        shared, compiler, modules, wininst)
 
 
 def header(env, out, cls, typeset, packages, excludes):

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/python.py?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/python.py (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/python.py Fri May 22 23:49:42 2009
@@ -390,7 +390,7 @@
 
 def python(env, out_h, out, cls, superCls, names, superNames,
            constructors, methods, protectedMethods, fields, instanceFields,
-           mapping, sequence, declares, typeset, excludes, moduleName):
+           mapping, sequence, rename, declares, typeset, excludes, moduleName):
 
     line(out_h)
     line(out_h, 0, '#include <Python.h>')
@@ -711,7 +711,7 @@
         if iteratorExt:
             tp_iter = 'get_extension_iterator'
         else:
-            tp_iter = 'get_iterator<t_%s>' %(names[-1])
+            tp_iter = '((PyObject *(*)(t_%s *)) get_iterator<t_%s>)' %(names[-1], names[-1])
         tp_iternext = '0'
     elif nextMethod and iterator.isAssignableFrom(cls):
         tp_iter = 'PyObject_SelfIter'
@@ -720,7 +720,7 @@
         if nextExt:
             tp_iternext = 'get_extension_next'
         else:
-            tp_iternext = '(get_iterator_next<%s%st_%s,%s>)' %(ns, sep, n, returnName)
+            tp_iternext = '((PyObject *(*)(java::util::t_Iterator *)) get_iterator_next<java::util::t_Iterator,%s%st_%s,%s>)' %(ns, sep, n, returnName)
     elif nextElementMethod and enumeration.isAssignableFrom(cls):
         tp_iter = 'PyObject_SelfIter'
         returnName = typename(nextElementMethod.getReturnType(), cls, False)
@@ -728,7 +728,7 @@
         if nextElementExt:
             tp_iternext = 'get_extension_nextElement'
         else:
-            tp_iternext = '(get_enumeration_nextElement<%s%st_%s,%s>)' %(ns, sep, n, returnName)
+            tp_iternext = '((PyObject *(*)(java::util::t_Enumeration *)) get_enumeration_next<java::util::t_Enumeration,%s%st_%s,%s>)' %(ns, sep, n, returnName)
     elif nextMethod:
         tp_iter = 'PyObject_SelfIter'
         returnName = typename(nextMethod.getReturnType(), cls, False)
@@ -736,7 +736,7 @@
         if nextExt:
             tp_iternext = 'get_extension_next'
         else:
-            tp_iternext = '(get_next<t_%s,%s%st_%s,%s>)' %(names[-1], ns, sep, n, returnName)
+            tp_iternext = '((PyObject *(*)(t_%s *)) get_next<t_%s,%s%st_%s,%s>)' %(names[-1], names[-1], ns, sep, n, returnName)
     else:
         tp_iter = '0'
         tp_iternext = '0'
@@ -807,10 +807,8 @@
     line(out)
     line(out, indent, 'void t_%s::install(PyObject *module)', names[-1])
     line(out, indent, '{')
-    if isExtension:
-        line(out, indent + 1, 'INSTALL_EXTENSION(%s, module);', names[-1])
-    else:
-        line(out, indent + 1, 'INSTALL_TYPE(%s, module);', names[-1])
+    line(out, indent + 1, 'installType(&%s$$Type, module, "%s", %d);',
+         names[-1], rename or names[-1], isExtension and 1 or 0)
     for inner in cls.getDeclaredClasses():
         if inner in typeset:
             if Modifier.isStatic(inner.getModifiers()):
@@ -1278,7 +1276,7 @@
 
 def compile(env, jccPath, output, moduleName, install, dist, debug, jars,
             version, prefix, root, install_dir, use_distutils,
-            shared, compiler, modules):
+            shared, compiler, modules, wininst):
 
     try:
         if use_distutils:
@@ -1402,7 +1400,9 @@
         script_args.append('--install-lib=%s' % install_dir)
 
     if dist:
-        if with_setuptools:
+        if wininst:
+            script_args.append('bdist_wininst')
+        elif with_setuptools:
             script_args.append('bdist_egg')
         else:
             script_args.append('bdist')

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.cpp?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.cpp (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.cpp Fri May 22 23:49:42 2009
@@ -151,7 +151,7 @@
                   break;
                 case 'k':
                   try {
-                      jclass (*initializeClass)() = va_arg(list, jclass (*)());
+                      getclassfn initializeClass = va_arg(list, getclassfn);
                       cls = (*initializeClass)();
                   } catch (JCCEnv::pythonError e) {
                       return -1;
@@ -497,7 +497,7 @@
                   cls = (jclass) va_arg(check, Class *)->this$;
                   break;
                 case 'k':
-                  jclass (*initializeClass)() = va_arg(check, jclass (*)());
+                  getclassfn initializeClass = va_arg(check, getclassfn);
                   cls = (*initializeClass)();
               }
 
@@ -1034,7 +1034,7 @@
     return value;
 }
 
-PyObject *castCheck(PyObject *obj, jclass (*initializeClass)(),
+PyObject *castCheck(PyObject *obj, getclassfn initializeClass,
                     int reportError)
 {
     if (PyObject_TypeCheck(obj, &FinalizerProxy$$Type))
@@ -1153,3 +1153,18 @@
 
     return array;
 }
+
+void installType(PyTypeObject *type, PyObject *module, char *name,
+                 int isExtension)
+{
+    if (PyType_Ready(type) == 0)
+    {
+        Py_INCREF(type);
+        if (isExtension)
+        {
+            type->ob_type = &FinalizerClass$$Type;
+            Py_INCREF(&FinalizerClass$$Type);
+        }
+        PyModule_AddObject(module, name, (PyObject *) type);
+    }
+}

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.h?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.h (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/functions.h Fri May 22 23:49:42 2009
@@ -30,6 +30,8 @@
 typedef intintobjargproc ssizessizeobjargproc;
 #endif
 
+typedef jclass (*getclassfn)(void);
+
 PyObject *PyErr_SetArgsError(char *name, PyObject *args);
 PyObject *PyErr_SetArgsError(PyObject *self, char *name, PyObject *args);
 PyObject *PyErr_SetArgsError(PyTypeObject *type, char *name, PyObject *args);
@@ -72,7 +74,7 @@
 java::lang::String p2j(PyObject *object);
 
 PyObject *make_descriptor(PyTypeObject *value);
-PyObject *make_descriptor(jclass (*initializeClass)(void));
+PyObject *make_descriptor(getclassfn initializeClass);
 PyObject *make_descriptor(PyObject *value);
 PyObject *make_descriptor(PyObject *(*wrapfn)(const jobject &));
 PyObject *make_descriptor(jboolean value);
@@ -91,20 +93,19 @@
 PyObject *callSuper(PyTypeObject *type, PyObject *self,
                     const char *name, PyObject *args, int cardinality);
 
-template<class T> PyObject *get_iterator(PyObject *self)
+template<class T> PyObject *get_iterator(T *self)
 {
     java::util::Iterator iterator((jobject) NULL);
 
-    OBJ_CALL(iterator = (((T *) self)->object.iterator()));
+    OBJ_CALL(iterator = self->object.iterator());
     return java::util::t_Iterator::wrap_Object(iterator);
 }
 
-template<class U, class V> PyObject *get_iterator_next(PyObject *self)
+template<class T, class U, class V> PyObject *get_iterator_next(T *self)
 {
-    java::util::t_Iterator *iterator = (java::util::t_Iterator *) self;
     jboolean hasNext;
 
-    OBJ_CALL(hasNext = iterator->object.hasNext());
+    OBJ_CALL(hasNext = self->object.hasNext());
     if (!hasNext)
     {
         PyErr_SetNone(PyExc_StopIteration);
@@ -112,7 +113,7 @@
     }
 
     V next((jobject) NULL);
-    OBJ_CALL(next = iterator->object.next());
+    OBJ_CALL(next = self->object.next());
 
     jclass cls = java::lang::String::initializeClass();
     if (env->get_vm_env()->IsInstanceOf(next.this$, cls))
@@ -121,12 +122,11 @@
     return U::wrap_Object(next);
 }
 
-template<class U, class V> PyObject *get_enumeration_nextElement(PyObject *self)
+template<class T, class U, class V> PyObject *get_enumeration_next(T *self)
 {
-    java::util::t_Enumeration *enumeration = (java::util::t_Enumeration *) self;
     jboolean hasMoreElements;
 
-    OBJ_CALL(hasMoreElements = enumeration->object.hasMoreElements());
+    OBJ_CALL(hasMoreElements = self->object.hasMoreElements());
     if (!hasMoreElements)
     {
         PyErr_SetNone(PyExc_StopIteration);
@@ -134,7 +134,7 @@
     }
 
     V next((jobject) NULL);
-    OBJ_CALL(next = enumeration->object.nextElement());
+    OBJ_CALL(next = self->object.nextElement());
 
     jclass cls = java::lang::String::initializeClass();
     if (env->get_vm_env()->IsInstanceOf(next.this$, cls))
@@ -143,12 +143,11 @@
     return U::wrap_Object(next);
 }
 
-template<class T, class U, class V> PyObject *get_next(PyObject *self)
+template<class T, class U, class V> PyObject *get_next(T *self)
 {
-    T *iterator = (T *) self;
     V next((jobject) NULL);
 
-    OBJ_CALL(next = iterator->object.next());
+    OBJ_CALL(next = self->object.next());
     if (!next)
     {
         PyErr_SetNone(PyExc_StopIteration);
@@ -167,8 +166,10 @@
 PyObject *get_extension_nextElement(PyObject *self);
 
 jobjectArray fromPySequence(jclass cls, PyObject *sequence);
-PyObject *castCheck(PyObject *obj, jclass (*initializeClass)(),
+PyObject *castCheck(PyObject *obj, getclassfn initializeClass,
                     int reportError);
+void installType(PyTypeObject *type, PyObject *module, char *name,
+                 int isExtension);
 
 extern PyTypeObject FinalizerClass$$Type;
 extern PyTypeObject FinalizerProxy$$Type;

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/jcc.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/jcc.cpp?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/jcc.cpp (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/jcc.cpp Fri May 22 23:49:42 2009
@@ -278,13 +278,17 @@
 
 _DLL_EXPORT PyObject *initJCC(PyObject *module)
 {
-    if (env == NULL)
+    static int _once_only = 1;
+
+    if (_once_only)
     {
         PyEval_InitThreads();
         INSTALL_TYPE(JCCEnv, module);
 
-        env = new JCCEnv(NULL, NULL);
+        if (env == NULL)
+            env = new JCCEnv(NULL, NULL);
 
+        _once_only = 0;
         Py_RETURN_TRUE;
     }
 

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/macros.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/macros.h?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/macros.h (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/macros.h Fri May 22 23:49:42 2009
@@ -123,7 +123,6 @@
 }                                                                       \
 
 
-
 #define INSTALL_TYPE(name, module)                                     \
     if (PyType_Ready(&name##$$Type) == 0)                              \
     {                                                                  \
@@ -131,14 +130,6 @@
         PyModule_AddObject(module, #name, (PyObject *) &name##$$Type); \
     }
 
-#define INSTALL_EXTENSION(name, module)                                \
-    if (PyType_Ready(&name##$$Type) == 0)                              \
-    {                                                                  \
-        Py_INCREF(&name##$$Type);                                      \
-        name##$$Type.ob_type = &FinalizerClass$$Type;                  \
-        PyModule_AddObject(module, #name, (PyObject *) &name##$$Type); \
-    }
-
 
 #define Py_RETURN_BOOL(b)                       \
     {                                           \

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/types.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/types.cpp?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/types.cpp (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/jcc/sources/types.cpp Fri May 22 23:49:42 2009
@@ -290,7 +290,7 @@
     int flags;
     union {
         PyObject *value;
-        jclass (*initializeClass)(void);
+        getclassfn initializeClass;
     } access;
 };
     
@@ -373,7 +373,7 @@
     return (PyObject *) self;
 }
 
-PyObject *make_descriptor(jclass (*initializeClass)(void))
+PyObject *make_descriptor(getclassfn initializeClass)
 {
     t_descriptor *self = (t_descriptor *)
         ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);

Modified: lucene/pylucene/tags/pylucene_2_4_1/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/tags/pylucene_2_4_1/jcc/setup.py?rev=777745&r1=777744&r2=777745&view=diff
==============================================================================
--- lucene/pylucene/tags/pylucene_2_4_1/jcc/setup.py (original)
+++ lucene/pylucene/tags/pylucene_2_4_1/jcc/setup.py Fri May 22 23:49:42 2009
@@ -12,7 +12,7 @@
 
 import os, sys, platform, subprocess
 
-jcc_ver = '2.2'
+jcc_ver = '2.3'
 python_ver = '%d.%d.%d' %(sys.version_info[0:3])
 machine = platform.machine()
 
@@ -74,7 +74,7 @@
 }
 
 LFLAGS = {
-    'darwin': ['-framework', 'JavaVM', '-framework', 'Python'],
+    'darwin': ['-framework', 'JavaVM'],
     'ipod': ['-ljvm', '-lpython%s.%s' %(sys.version_info[0:2]),
              '-L/usr/lib/gcc/arm-apple-darwin9/4.0.1'],
     'linux2/i386': ['-L%(linux2)s/jre/lib/i386' %(JDK), '-ljava',