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/10/27 22:00:31 UTC

svn commit: r830336 - in /lucene/pylucene/branches/pylucene_2_9/jcc: CHANGES jcc/patches/patch.43 jcc/patches/patch.43.0.6c11 jcc/patches/patch.43.0.6c7 setup.py

Author: vajda
Date: Tue Oct 27 21:00:31 2009
New Revision: 830336

URL: http://svn.apache.org/viewvc?rev=830336&view=rev
Log:
renamed patch.43 to differentiate setuptools versions

Added:
    lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c11
    lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c7
      - copied unchanged from r829919, lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43
Removed:
    lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43
Modified:
    lucene/pylucene/branches/pylucene_2_9/jcc/CHANGES
    lucene/pylucene/branches/pylucene_2_9/jcc/setup.py

Modified: lucene/pylucene/branches/pylucene_2_9/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_2_9/jcc/CHANGES?rev=830336&r1=830335&r2=830336&view=diff
==============================================================================
--- lucene/pylucene/branches/pylucene_2_9/jcc/CHANGES (original)
+++ lucene/pylucene/branches/pylucene_2_9/jcc/CHANGES Tue Oct 27 21:00:31 2009
@@ -2,6 +2,7 @@
 --------------------
  - fixed bug in code comparing setuptools versions when >= 0.6c10
  - verified build against setuptools from distribute 0.6.6
+ - renamed patch.43 to differentiate setuptools versions
  - 
 
 Version 2.3 -> 2.4

Added: lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c11
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c11?rev=830336&view=auto
==============================================================================
--- lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c11 (added)
+++ lucene/pylucene/branches/pylucene_2_9/jcc/jcc/patches/patch.43.0.6c11 Tue Oct 27 21:00:31 2009
@@ -0,0 +1,135 @@
+Index: setuptools/extension.py
+===================================================================
+--- setuptools/extension.py	(revision 75864)
++++ setuptools/extension.py	(working copy)
+@@ -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
+Index: setuptools/command/build_ext.py
+===================================================================
+--- setuptools/command/build_ext.py	(revision 75864)
++++ setuptools/command/build_ext.py	(working copy)
+@@ -85,8 +85,12 @@
+         if fullname in self.ext_map:
+             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)
+@@ -170,14 +174,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):
+@@ -244,44 +256,41 @@
+                 os.unlink(stub_file)
+ 
+ 
+-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
+-        )
+-else:
+-    # Build static libraries everywhere else
+-    libtype = 'static'
++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 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
++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:]
++    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
+-        )
++    self.create_static_lib(objects, basename, output_dir, debug, target_lang)
+ 
+ 
++if use_stubs or os.name=='nt':
++    # Build shared libraries
++    link_shared_object = sh_link_shared_object
++else:
++    # Build static libraries everywhere else (unless force_shared)
++    libtype = 'static'
++    link_shared_object = st_link_shared_object

Modified: lucene/pylucene/branches/pylucene_2_9/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_2_9/jcc/setup.py?rev=830336&r1=830335&r2=830336&view=diff
==============================================================================
--- lucene/pylucene/branches/pylucene_2_9/jcc/setup.py (original)
+++ lucene/pylucene/branches/pylucene_2_9/jcc/setup.py Tue Oct 27 21:00:31 2009
@@ -112,8 +112,9 @@
     with_setuptools = require('setuptools')[0].parsed_version
     
     enable_shared = False
-    with_setuptools_min = ('00000000', '00000006', '*c', '00000007', '*final')
-    if with_setuptools >= with_setuptools_min and 'NO_SHARED' not in os.environ:
+    with_setuptools_c7 = ('00000000', '00000006', '*c', '00000007', '*final')
+    with_setuptools_c11 = ('00000000', '00000006', '*c', '00000011', '*final')
+    if with_setuptools >= with_setuptools_c7 and 'NO_SHARED' not in os.environ:
         if platform in ('darwin', 'ipod', 'win32'):
             enable_shared = True
         elif platform == 'linux2':
@@ -124,34 +125,38 @@
                 import setuptools
                 jccdir = os.path.dirname(os.path.abspath(__file__))
                 st_egg = os.path.dirname(setuptools.__path__[0])
+                if with_setuptools < with_setuptools_c11:
+                    patch_version = '0.6c7'
+                else:
+                    patch_version = '0.6c11'
 
                 def patch_st_dir():
                     return '''
 
-Shared mode is disabled, setuptools patch.43 must be applied to enable it
+Shared mode is disabled, setuptools patch.43.%s must be applied to enable it
 or the NO_SHARED environment variable must be set to turn off this error.
 
-    sudo patch -d %s -Nup0 < %s/jcc/patches/patch.43
+    sudo patch -d %s -Nup0 < %s/jcc/patches/patch.43.%s
 
 See %s/INSTALL for more information about shared mode.
-''' %(st_egg, jccdir, jccdir)
+''' %(patch_version, st_egg, jccdir, jccdir, patch_version)
 
                 def patch_st_zip():
                     return '''
 
-Shared mode is disabled, setuptools patch.43 must be applied to enable it
+Shared mode is disabled, setuptools patch.43.%s must be applied to enable it
 or the NO_SHARED environment variable must be set to turn off this error.
 
     mkdir tmp
     cd tmp
     unzip -q %s
-    patch -Nup0 < %s/jcc/patches/patch.43
+    patch -Nup0 < %s/jcc/patches/patch.43.%s
     sudo zip %s -f
     cd ..
     rm -rf tmp
 
 See %s/INSTALL for more information about shared mode.
-''' %(st_egg, jccdir, st_egg, jccdir)
+''' %(patch_version, st_egg, jccdir, patch_version, st_egg, jccdir)
 
                 if os.path.isdir(st_egg):
                     raise NotImplementedError, patch_st_dir()