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 2010/03/23 03:57:34 UTC
svn commit: r926450 - in /lucene/pylucene/trunk: ./ jcc/ jcc/helpers/
jcc/jcc/
Author: vajda
Date: Tue Mar 23 02:57:34 2010
New Revision: 926450
URL: http://svn.apache.org/viewvc?rev=926450&view=rev
Log:
- improved support for building on Windows with mingw32 (Bill Janssen)
- added wininst target to Makefile (Bill Janssen)
- added support for --find-jvm-dll jvm.dll (Bill Janssen)
Added:
lucene/pylucene/trunk/jcc/helpers/
lucene/pylucene/trunk/jcc/helpers/linux.py (with props)
lucene/pylucene/trunk/jcc/helpers/mingw32.py (with props)
lucene/pylucene/trunk/jcc/helpers/windows.py (with props)
Modified:
lucene/pylucene/trunk/CHANGES
lucene/pylucene/trunk/Makefile
lucene/pylucene/trunk/jcc/CHANGES
lucene/pylucene/trunk/jcc/MANIFEST.in
lucene/pylucene/trunk/jcc/jcc/__main__.py
lucene/pylucene/trunk/jcc/jcc/cpp.py
lucene/pylucene/trunk/jcc/jcc/python.py
lucene/pylucene/trunk/jcc/jcc/windows.py
lucene/pylucene/trunk/jcc/setup.py
Modified: lucene/pylucene/trunk/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/CHANGES?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/CHANGES (original)
+++ lucene/pylucene/trunk/CHANGES Tue Mar 23 02:57:34 2010
@@ -1,4 +1,10 @@
+Version 3.0.0 ->
+----------------
+ - improved support for building on Windows with mingw32
+ - added wininst target to Makefile
+ -
+
Version 2.9.0 -> 3.0.0
----------------------
- unit tests ported to new API
Modified: lucene/pylucene/trunk/Makefile
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/Makefile?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/Makefile (original)
+++ lucene/pylucene/trunk/Makefile Tue Mar 23 02:57:34 2010
@@ -14,10 +14,10 @@
# site-packages directory.
#
-VERSION=3.0.0-1
+VERSION=3.0.1-1
LUCENE_SVN_VER=HEAD
LUCENE_VER=3.0.0
-LUCENE_SVN=http://svn.apache.org/repos/asf/lucene/java/tags/lucene_3_0_0
+LUCENE_SVN=http://svn.apache.org/repos/asf/lucene/java/tags/lucene_3_0_1
PYLUCENE:=$(shell pwd)
LUCENE=lucene-java-$(LUCENE_VER)
@@ -118,6 +118,14 @@ LUCENE=lucene-java-$(LUCENE_VER)
#JCC=$(PYTHON) -m jcc --shared
#NUM_FILES=3
+# Windows (Win32, msys/MinGW, Python 2.6.4, Java 1.6, ant 1.7.1 (WinAnt))
+#PREFIX_PYTHON=/c/Python26
+#ANT=JAVA_HOME="c:\\Program Files\\Java\\jdk1.6.0_18" "/c/Program Files/WinAnt/bin/ant"
+#PYTHON=$(PREFIX_PYTHON)/python.exe
+#JCC=$(PYTHON) -m jcc.__main__ --shared --compiler mingw32
+#NUM_FILES=3
+
+
#
# No edits required below
#
@@ -228,6 +236,9 @@ install: jars
bdist: jars
$(GENERATE) --bdist
+wininst: jars
+ $(GENERATE) --wininst
+
all: sources jars compile
@echo build of $(PYLUCENE_LIB) complete
@@ -239,10 +250,10 @@ realclean:
rm -rf $(LUCENE) build samples/LuceneInAction/index
-BUILD_TEST:=$(PYLUCENE)/build/test:$(PYTHONPATH)
+BUILD_TEST:=$(PYLUCENE)/build/test
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
-BUILD_TEST:=`cygpath -awp $(BUILD_TEST)`
+BUILD_TEST:=`cygpath -aw $(BUILD_TEST)`
endif
install-test:
Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Tue Mar 23 02:57:34 2010
@@ -3,8 +3,10 @@ Version 2.5 ->
------------------
- added freebsd7 settings to setup.py (Sujan Shakya)
- added support for unix-specific --home distutils install parameter
- - added support for extracting JAVAHOME from windows registry (Bill Janssen)
+ - added support for extracting JAVAHOME from Windows registry (Bill Janssen)
- updated MANIFEST.in as sdist started creating incomplete source archives
+ - improved support for building on Windows with mingw32 (Bill Janssen)
+ - added support for --find-jvm-dll jvm.dll (Bill Janssen)
-
Version 2.4 -> 2.5
Modified: lucene/pylucene/trunk/jcc/MANIFEST.in
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/MANIFEST.in?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/MANIFEST.in (original)
+++ lucene/pylucene/trunk/jcc/MANIFEST.in Tue Mar 23 02:57:34 2010
@@ -3,6 +3,7 @@ include jcc/patches/patch.*
recursive-include jcc *.h
recursive-include _jcc *.h
recursive-include java *.java
+recursive-include helpers *.py
include CHANGES
include DESCRIPTION
include INSTALL
Added: lucene/pylucene/trunk/jcc/helpers/linux.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/helpers/linux.py?rev=926450&view=auto
==============================================================================
--- lucene/pylucene/trunk/jcc/helpers/linux.py (added)
+++ lucene/pylucene/trunk/jcc/helpers/linux.py Tue Mar 23 02:57:34 2010
@@ -0,0 +1,67 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+
+def patch_st_dir(patch_version, st_egg, jccdir):
+ return '''
+
+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.%s
+
+See %s/INSTALL for more information about shared mode.
+''' %(patch_version, st_egg, jccdir, patch_version, jccdir)
+
+
+def patch_st_zip(patch_version, st_egg, jccdir):
+ return '''
+
+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.%s
+ sudo zip %s -f
+ cd ..
+ rm -rf tmp
+
+See %s/INSTALL for more information about shared mode.
+''' %(patch_version, st_egg, jccdir, patch_version, st_egg, jccdir)
+
+
+def patch_setuptools():
+
+ try:
+ from setuptools.command.build_ext import sh_link_shared_object
+ enable_shared = True # jcc/patches/patch.43 was applied
+ except ImportError:
+ import setuptools
+ jccdir = os.path.dirname(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'
+
+ if os.path.isdir(st_egg):
+ raise NotImplementedError, patch_st_dir(patch_version, st_egg,
+ jccdir)
+ else:
+ raise NotImplementedError, patch_st_zip(patch_version, st_egg,
+ jccdir)
+
+ return enable_shared
Propchange: lucene/pylucene/trunk/jcc/helpers/linux.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/pylucene/trunk/jcc/helpers/linux.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: lucene/pylucene/trunk/jcc/helpers/mingw32.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/helpers/mingw32.py?rev=926450&view=auto
==============================================================================
--- lucene/pylucene/trunk/jcc/helpers/mingw32.py (added)
+++ lucene/pylucene/trunk/jcc/helpers/mingw32.py Tue Mar 23 02:57:34 2010
@@ -0,0 +1,31 @@
+
+import distutils.cygwinccompiler, copy
+
+orig_Mingw32CCompiler = distutils.cygwinccompiler.Mingw32CCompiler
+
+
+class JCCMinGW32CCompiler(orig_Mingw32CCompiler):
+
+ def link(self, target_desc, objects, output_filename, 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):
+
+ # use separate copies, so we can modify the lists
+ extra_preargs = copy.copy(extra_preargs or [])
+
+ (dll_name, dll_extension) = os.path.splitext(output_filename)
+ if dll_extension.lower() == ".dll":
+ extra_preargs.extend(["-Wl,--out-implib,%s" %(os.path.join(os.path.dirname(dll_name), "jcc", "jcc.lib"))])
+
+ orig_Mingw32CCompiler.link(self, target_desc=target_desc,
+ objects=objects,
+ output_filename=output_filename,
+ output_dir=output_dir, libraries=libraries,
+ library_dirs=library_dirs,
+ runtime_library_dirs=runtime_library_dirs,
+ export_symbols=export_symbols, debug=debug,
+ extra_preargs=extra_preargs,
+ extra_postargs=extra_postargs,
+ build_temp=build_temp,
+ target_lang=target_lang)
Propchange: lucene/pylucene/trunk/jcc/helpers/mingw32.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/pylucene/trunk/jcc/helpers/mingw32.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: lucene/pylucene/trunk/jcc/helpers/windows.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/helpers/windows.py?rev=926450&view=auto
==============================================================================
--- lucene/pylucene/trunk/jcc/helpers/windows.py (added)
+++ lucene/pylucene/trunk/jcc/helpers/windows.py Tue Mar 23 02:57:34 2010
@@ -0,0 +1,54 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+
+global JAVAHOME
+JAVAHOME = None
+
+if sys.platform == "win32":
+ # figure out where the JDK lives
+
+ try:
+ import _winreg as wreg
+
+ class WindowsRegistry:
+ # see the Python Cookbook, #146305, Dirk Holtwick
+
+ def __init__(self, keyname):
+ " handle registry access "
+ self.reg = wreg.ConnectRegistry(None, wreg.HKEY_LOCAL_MACHINE)
+ self.key = wreg.OpenKey(self.reg, keyname)
+
+ def get(self, name):
+ " get value out of registry "
+ v, t = wreg.QueryValueEx(self.key, name)
+ return v, t
+
+ def close(self):
+ " close the key finally "
+ self.key.Close()
+ self.reg.Close()
+
+ def __del__(self):
+ self.close()
+
+ def get_registry_value(vname, subname):
+ r = WindowsRegistry(vname)
+ v, t = r.get(subname)
+ return v
+
+ javaversion = get_registry_value(r"SOFTWARE\JavaSoft\Java Development Kit", "CurrentVersion")
+ JAVAHOME = get_registry_value(r"SOFTWARE\JavaSoft\Java Development Kit\%s" % javaversion, "JavaHome")
+
+ except:
+ JAVAHOME = 'c:/Program Files/Java/jdk1.6.0_18'
Propchange: lucene/pylucene/trunk/jcc/helpers/windows.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/pylucene/trunk/jcc/helpers/windows.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: lucene/pylucene/trunk/jcc/jcc/__main__.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/__main__.py?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/__main__.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/__main__.py Tue Mar 23 02:57:34 2010
@@ -1,5 +1,10 @@
import sys
+
+if sys.platform == 'win32' and '--find-jvm-dll' in sys.argv:
+ from windows import add_jvm_dll_directory_to_path
+ add_jvm_dll_directory_to_path()
+
from jcc import cpp
if len(sys.argv) == 1 or '--help' in sys.argv:
@@ -63,6 +68,9 @@ if len(sys.argv) == 1 or '--help' in sys
--arch - Mac OS X only: filter the -arch parameters
Python was configured with to build leaner
binaries, faster
+ --find-jvm-dll - Windows only: extract the directory containing
+ jvm.dll from the registry and append it to the
+ Path at runtime
Actions:
--build - generate the wrapper and compile it
@@ -70,7 +78,7 @@ if len(sys.argv) == 1 or '--help' in sys
--install - install the wrapper in the local site-packages
Distribution actions:
- --use-distutils - use distutils even when setuptools is availble
+ --use-distutils - use distutils even when setuptools is available
--bdist - generate a binary distutils-based distribution
or a setuptools-based .egg
--wininst - create an installer application for Microsoft
Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Tue Mar 23 02:57:34 2010
@@ -313,6 +313,7 @@ def jcc(args):
shared = False
dist = False
wininst = False
+ find_jvm_dll = False
compiler = None
generics = hasattr(_jcc, "Type")
arch = []
@@ -418,6 +419,8 @@ def jcc(args):
arch.append(args[i])
elif arg == '--no-generics':
generics = False
+ elif arg == '--find-jvm-dll':
+ find_jvm_dll = True
else:
raise ValueError, "Invalid argument: %s" %(arg)
else:
@@ -440,7 +443,8 @@ def jcc(args):
compile(env, os.path.dirname(args[0]), output, moduleName,
install, dist, debug, jars, version,
prefix, root, install_dir, home_dir, use_distutils,
- shared, compiler, modules, wininst, arch, generics)
+ shared, compiler, modules, wininst, find_jvm_dll,
+ arch, generics)
else:
for className in classNames:
if className in excludes:
@@ -556,7 +560,8 @@ def jcc(args):
compile(env, os.path.dirname(args[0]), output, moduleName,
install, dist, debug, jars, version,
prefix, root, install_dir, home_dir, use_distutils,
- shared, compiler, modules, wininst, arch, generics)
+ shared, compiler, modules, wininst, find_jvm_dll,
+ arch, generics)
def header(env, out, cls, typeset, packages, excludes, generics):
Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Tue Mar 23 02:57:34 2010
@@ -1403,7 +1403,7 @@ def module(out, allInOne, classes, cppdi
def compile(env, jccPath, output, moduleName, install, dist, debug, jars,
version, prefix, root, install_dir, home_dir, use_distutils,
- shared, compiler, modules, wininst, arch, generics):
+ shared, compiler, modules, wininst, find_jvm_dll, arch, generics):
try:
if use_distutils:
@@ -1432,6 +1432,9 @@ def compile(env, jccPath, output, module
line(out, 0, "import os, sys")
line(out)
line(out, 0, "if sys.platform == 'win32':")
+ if find_jvm_dll:
+ line(out, 1, "from jcc.windows import add_jvm_dll_directory_to_path")
+ line(out, 1, "add_jvm_dll_directory_to_path()")
line(out, 1, "import jcc, %s", extname)
line(out, 0, "else:")
line(out, 1, "import %s", extname)
Modified: lucene/pylucene/trunk/jcc/jcc/windows.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/windows.py?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/windows.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/windows.py Tue Mar 23 02:57:34 2010
@@ -1,43 +1,85 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-import sys
+import os, _winreg
-global JAVAHOME
-JAVAHOME = None
-if sys.platform == "win32":
- # figure out where the JDK lives
+class WindowsRegistry(object):
- try:
- import _winreg as wreg
+ def __init__(self):
+ self.handle = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
+
+ def get(self, key, name):
+
+ key = None
+ try:
+ key = _winreg.OpenKey(self.handle, keyname)
+ return _winreg.QueryValueEx(key, name)[0]
+ finally:
+ if key is not None:
+ key.Close()
+
+ def close(self):
+ self.handle.Close()
- class WindowsRegistry:
- # see the Python Cookbook, #146305, Dirk Holtwick
- def __init__(self, keyname):
- " handle registry access "
- self.reg = wreg.ConnectRegistry(None, wreg.HKEY_LOCAL_MACHINE)
- self.key = wreg.OpenKey(self.reg, keyname)
-
- def get(self, name):
- " get value out of registry "
- v, t = wreg.QueryValueEx(self.key, name)
- return v, t
-
- def close(self):
- " close the key finally "
- self.key.Close()
- self.reg.Close()
-
- def __del__(self):
- self.close()
-
- def get_registry_value(vname, subname):
- r = WindowsRegistry(vname)
- v, t = r.get(subname)
- return v
+def get_jvm_dll_directory(client_or_server="client"):
+
+ jre_key = r"SOFTWARE\JavaSoft\Java Runtime Environment"
+ jdk_key = r"SOFTWARE\JavaSoft\Java Development Kit"
+ current_key = r"%s\%s"
+
+ registry = None
+ try:
+ registry = WindowsRegistry()
- javaversion = get_registry_value(r"SOFTWARE\JavaSoft\Java Development Kit", "CurrentVersion")
- JAVAHOME = get_registry_value(r"SOFTWARE\JavaSoft\Java Development Kit\%s" % javaversion, "JavaHome")
+ try: # try JRE
+ version = registry.get(jre_key, "CurrentVersion")
+ path = registry.get(current_key %(jre_key, version), "JavaHome")
+ if not os.path.exists(path):
+ path = None
+ except:
+ path = None
+
+ if not path:
+ try: # try JDK
+ version = registry.get(jdk_key, "CurrentVersion")
+ path = registry.get(current_key %(jdk_key, version), "JavaHome")
+ if os.path.exists(path):
+ path = os.path.abspath(os.path.join(path, "jre"))
+ else:
+ path = None
+ except:
+ path = None
+
+ finally:
+ if registry is not None:
+ registry.close()
+
+ if path:
+ path = os.path.abspath(os.path.join(path, "bin", client_or_server))
+ if os.path.exists(os.path.join(path, "jvm.dll")):
+ return path
+
+ return None
+
+
+def add_jvm_dll_directory_to_path():
+
+ path = os.environ['Path'].split(os.pathsep)
+ dll_path = get_jvm_dll_directory()
+ if dll_path is not None:
+ path.append(dll_path)
+ os.environ['Path'] = os.pathsep.join(path)
+ return True
- except:
- JAVAHOME = 'c:/Program Files/Java/jdk1.6.0_18'
+ raise ValueError, "jvm.dll could not be found"
Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=926450&r1=926449&r2=926450&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Tue Mar 23 02:57:34 2010
@@ -35,9 +35,9 @@ else:
# JCC_LFLAGS and JCC_JAVAC environment variables using os.pathsep as value
# separator.
-if sys.platform == "win32":
+if platform in ("win32", "mingw32"):
try:
- from jcc.windows import JAVAHOME
+ from helpers.windows import JAVAHOME
except ImportError:
JAVAHOME = None
else:
@@ -55,6 +55,26 @@ JDK = {
if 'JCC_JDK' in os.environ:
JDK[platform] = os.environ['JCC_JDK']
+
+if not JDK[platform]:
+ raise RuntimeError('''
+
+Can't determine where the Java JDK has been installed on this machine.
+
+Please set the environment variable JCC_JDK to that location before
+running setup.py.
+''')
+
+elif not os.path.isdir(JDK[platform]):
+ raise RuntimeError('''
+
+Java JDK directory '%s' does not exist.
+
+Please set the environment variable JCC_JDK to the correct location before
+running setup.py.
+''' %(JDK[platform]))
+
+
INCLUDES = {
'darwin': ['%(darwin)s/Headers' %(JDK)],
'ipod': ['%(ipod)s/darwin/default' %(JDK)],
@@ -64,8 +84,8 @@ INCLUDES = {
'%(sunos5)s/include/solaris' %(JDK)],
'win32': ['%(win32)s/include' %(JDK),
'%(win32)s/include/win32' %(JDK)],
- 'mingw32': ['%(win32)s/include' %(JDK),
- '%(win32)s/include/win32' %(JDK)],
+ 'mingw32': ['%(mingw32)s/include' %(JDK),
+ '%(mingw32)s/include/win32' %(JDK)],
'freebsd7': ['%(freebsd7)s/include' %(JDK),
'%(freebsd7)s/include/freebsd' %(JDK)],
}
@@ -77,7 +97,7 @@ CFLAGS = {
'sunos5': ['-features=iddollar',
'-erroff=badargtypel2w,wbadinitl,wvarhidemem'],
'win32': [],
- 'mingw32': ['-Wno-write-strings'],
+ 'mingw32': ['-fno-strict-aliasing', '-Wno-write-strings'],
'freebsd7': ['-fno-strict-aliasing', '-Wno-write-strings'],
}
@@ -139,54 +159,20 @@ try:
enable_shared = False
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':
- try:
- from setuptools.command.build_ext import sh_link_shared_object
- enable_shared = True # jcc/patches/patch.43 was applied
- except ImportError:
- 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.%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.%s
-
-See %s/INSTALL for more information about shared mode.
-''' %(patch_version, st_egg, jccdir, patch_version, jccdir)
-
- def patch_st_zip():
- return '''
-
-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.%s
- sudo zip %s -f
- cd ..
- rm -rf tmp
-
-See %s/INSTALL for more information about shared mode.
-''' %(patch_version, st_egg, jccdir, patch_version, st_egg, jccdir)
-
- if os.path.isdir(st_egg):
- raise NotImplementedError, patch_st_dir()
- else:
- raise NotImplementedError, patch_st_zip()
+ from helpers.linux import patch_setuptools
+ enable_shared = patch_setuptools()
+ elif platform == 'mingw32':
+ enable_shared = True
+ # need to monkeypatch the CygwinCCompiler class to generate
+ # jcc.lib in the correct place
+ from helpers.mingw32 import JCCMinGW32CCompiler
+ import distutils.cygwinccompiler
+ distutils.cygwinccompiler.Mingw32CCompiler = JCCMinGW32CCompiler
except ImportError:
if sys.version_info < (2, 4):