First, the patch  jcc/jcc/patches/patch.43.0.6c11 doesn't quite work 
for Python2.7.1. I have attached a modified patch.

More serious is the following error during make
(I'm using sun-jdk-1.6.0.23)

ant -f extensions.xml -Dlucene.dir=lucene-java-3.x
Buildfile: /Work1/Obj/Python/pylucene-build/extensions.xml

compile:
    [mkdir] Created dir: /Work1/Obj/Python/pylucene-build/build/classes
    [javac] /Work1/Obj/Python/pylucene-build/extensions.xml:19: 
warning: 'includeantruntime' was not set, defaulting to 
build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 29 source files to /Work1/Obj/Python/pylucene-
build/build/classes
    [javac] /Work1/Obj/Python/pylucene-build/java/org/apache/pylucene/
search/PythonSimilarity.java:25: 
org.apache.pylucene.search.PythonSimilarity is not abstract and does 
not override abstract method computeNorm
(java.lang.String,org.apache.lucene.index.FieldInvertState) in 
org.apache.lucene.search.Similarity
    [javac] public class PythonSimilarity extends Similarity {
    [javac]        ^
    [javac] /Work1/Obj/Python/pylucene-build/java/org/apache/pylucene/
search/PythonSimilarity.java:70: lengthNorm(java.lang.String,int) in 
org.apache.pylucene.search.PythonSimilarity cannot override lengthNorm
(java.lang.String,int) in org.apache.lucene.search.Similarity; 
overridden method is final
    [javac]     public native float lengthNorm(String fieldName, int 
numTokens);
    [javac]                         ^
    [javac] /Work1/Obj/Python/pylucene-build/java/org/apache/pylucene/
search/PythonSimilarityDelegator.java:49: lengthNorm
(java.lang.String,int) in 
org.apache.pylucene.search.PythonSimilarityDelegator cannot override 
lengthNorm(java.lang.String,int) in 
org.apache.lucene.search.Similarity; overridden method is final
    [javac]     public native float lengthNorm(String fieldName, int 
numTokens);
    [javac]                         ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 3 errors

BUILD FAILED
/Work1/Obj/Python/pylucene-build/extensions.xml:19: Compile failed; see 
the compiler error output for details.


Thanks for looking into it,
Helmut.


-- 
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--- setuptools/extension.py.ORIG	2010-07-15 01:53:38.000000000 +0200
+++ setuptools/extension.py	2011-01-11 09:31:35.737668366 +0100
@@ -28,6 +28,11 @@
 class Library(Extension):
     """Just like a regular Extension, but built as a library instead"""
 
+    def __init__(self, *args, **kwds):
+        self.force_shared = kwds.pop('force_shared', False)
+        Extension.__init__(self, *args, **kwds)
+
+
 import sys, distutils.core, distutils.extension
 distutils.core.Extension = Extension
 distutils.extension.Extension = Extension
--- setuptools/command/build_ext.py.ORIG	2011-01-11 09:30:11.000000000 +0100
+++ setuptools/command/build_ext.py	2011-01-11 09:33:33.556666899 +0100
@@ -91,8 +91,12 @@
             return filename
         ext = self.ext_map[fullname]
         if isinstance(ext,Library):
+            if ext.force_shared and not use_stubs:
+	        _libtype = 'shared'
+            else:
+	        _libtype = libtype
             fn, ext = os.path.splitext(filename)
-            return self.shlib_compiler.library_filename(fn,libtype)
+            return self.shlib_compiler.library_filename(fn,_libtype)
         elif use_stubs and ext._links_to_dynamic:
             d,fn = os.path.split(filename)
             return os.path.join(d,'dl-'+fn)
@@ -182,14 +186,22 @@
     def build_extension(self, ext):
         _compiler = self.compiler
         try:
+            force_shared = False
             if isinstance(ext,Library):
                 self.compiler = self.shlib_compiler
+                force_shared = ext.force_shared and not use_stubs
+                if force_shared:
+                    self.compiler.link_shared_object = \
+                        sh_link_shared_object.__get__(self.compiler)
             _build_ext.build_extension(self,ext)
             if ext._needs_stub:
                 self.write_stub(
                     self.get_finalized_command('build_py').build_lib, ext
                 )
         finally:
+            if force_shared:
+                self.compiler.link_shared_object = \
+                    link_shared_object.__get__(self.compiler)
             self.compiler = _compiler
 
     def links_to_dynamic(self, ext):
@@ -256,44 +268,41 @@
                 os.unlink(stub_file)
 
 
+def sh_link_shared_object(self, objects, output_libname, output_dir=None,
+    libraries=None, library_dirs=None, runtime_library_dirs=None,
+    export_symbols=None, debug=0, extra_preargs=None,
+    extra_postargs=None, build_temp=None, target_lang=None
+):  self.link(self.SHARED_LIBRARY, objects, output_libname,
+              output_dir, libraries, library_dirs, runtime_library_dirs,
+              export_symbols, debug, extra_preargs, extra_postargs,
+              build_temp, target_lang)
+
+def st_link_shared_object(self, objects, output_libname, output_dir=None,
+    libraries=None, library_dirs=None, runtime_library_dirs=None,
+    export_symbols=None, debug=0, extra_preargs=None,
+    extra_postargs=None, build_temp=None, target_lang=None
+):
+    # XXX we need to either disallow these attrs on Library instances,
+    #     or warn/abort here if set, or something...
+    #libraries=None, library_dirs=None, runtime_library_dirs=None,
+    #export_symbols=None, extra_preargs=None, extra_postargs=None,
+    #build_temp=None
+
+    assert output_dir is None   # distutils build_ext doesn't pass this
+    output_dir,filename = os.path.split(output_libname)
+    basename, ext = os.path.splitext(filename)
+    if self.library_filename("x").startswith('lib'):
+        # strip 'lib' prefix; this is kludgy if some platform uses
+        # a different prefix
+        basename = basename[3:]
+
+    self.create_static_lib(objects, basename, output_dir, debug, target_lang)
+
+
 if use_stubs or os.name=='nt':
     # Build shared libraries
-    #
-    def link_shared_object(self, objects, output_libname, output_dir=None,
-        libraries=None, library_dirs=None, runtime_library_dirs=None,
-        export_symbols=None, debug=0, extra_preargs=None,
-        extra_postargs=None, build_temp=None, target_lang=None
-    ):  self.link(
-            self.SHARED_LIBRARY, objects, output_libname,
-            output_dir, libraries, library_dirs, runtime_library_dirs,
-            export_symbols, debug, extra_preargs, extra_postargs,
-            build_temp, target_lang
-        )
+    link_shared_object = sh_link_shared_object
 else:
-    # Build static libraries everywhere else
+    # Build static libraries everywhere else (unless force_shared)
     libtype = 'static'
-
-    def link_shared_object(self, objects, output_libname, output_dir=None,
-        libraries=None, library_dirs=None, runtime_library_dirs=None,
-        export_symbols=None, debug=0, extra_preargs=None,
-        extra_postargs=None, build_temp=None, target_lang=None
-    ):
-        # XXX we need to either disallow these attrs on Library instances,
-        #     or warn/abort here if set, or something...
-        #libraries=None, library_dirs=None, runtime_library_dirs=None,
-        #export_symbols=None, extra_preargs=None, extra_postargs=None,
-        #build_temp=None
-
-        assert output_dir is None   # distutils build_ext doesn't pass this
-        output_dir,filename = os.path.split(output_libname)
-        basename, ext = os.path.splitext(filename)
-        if self.library_filename("x").startswith('lib'):
-            # strip 'lib' prefix; this is kludgy if some platform uses
-            # a different prefix
-            basename = basename[3:]
-
-        self.create_static_lib(
-            objects, basename, output_dir, debug, target_lang
-        )
-
-
+    link_shared_object = st_link_shared_object

Reply via email to