lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r925041 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/windows.py setup.py
Date Thu, 18 Mar 2010 23:24:12 GMT
Author: vajda
Date: Thu Mar 18 23:24:12 2010
New Revision: 925041

URL: http://svn.apache.org/viewvc?rev=925041&view=rev
Log:
 - added support for extracting JAVAHOME from windows registry (Bill Janssen)

Added:
    lucene/pylucene/trunk/jcc/jcc/windows.py   (with props)
Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/setup.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=925041&r1=925040&r2=925041&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Thu Mar 18 23:24:12 2010
@@ -3,6 +3,7 @@ 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)
  - 
 
 Version 2.4 -> 2.5

Added: lucene/pylucene/trunk/jcc/jcc/windows.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/windows.py?rev=925041&view=auto
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/windows.py (added)
+++ lucene/pylucene/trunk/jcc/jcc/windows.py Thu Mar 18 23:24:12 2010
@@ -0,0 +1,43 @@
+
+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/jcc/windows.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/pylucene/trunk/jcc/jcc/windows.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=925041&r1=925040&r2=925041&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Thu Mar 18 23:24:12 2010
@@ -17,6 +17,8 @@ machine = platform.machine()
 
 if machine.startswith("iPod") or machine.startswith("iPhone"):
     platform = 'ipod'
+elif (sys.platform == "win32") and "--compiler=mingw32" in sys.argv:
+    platform = 'mingw32'
 else:
     platform = sys.platform
 
@@ -33,13 +35,22 @@ else:
 # JCC_LFLAGS and JCC_JAVAC environment variables using os.pathsep as value
 # separator.
 
+if sys.platform == "win32":
+    try:
+        from jcc.windows import JAVAHOME
+    except ImportError:
+        JAVAHOME = None
+else:
+    JAVAHOME = None
+
 JDK = {
     'darwin': '/System/Library/Frameworks/JavaVM.framework/Versions/Current',
     'ipod': '/usr/include/gcc',
     'linux2': '/usr/lib/jvm/java-6-openjdk',
     'sunos5': '/usr/jdk/instances/jdk1.6.0',
-    'win32': 'o:/Java/jdk1.6.0_02',
-    'freebsd7': '/usr/local/diablo-jdk1.6.0',
+    'win32': JAVAHOME,
+    'mingw32': JAVAHOME,
+    'freebsd7': '/usr/local/diablo-jdk1.6.0'
 }
 if 'JCC_JDK' in os.environ:
     JDK[platform] = os.environ['JCC_JDK']
@@ -53,6 +64,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)],
     'freebsd7': ['%(freebsd7)s/include' %(JDK),
                  '%(freebsd7)s/include/freebsd' %(JDK)],
 }
@@ -64,6 +77,7 @@ CFLAGS = {
     'sunos5': ['-features=iddollar',
                '-erroff=badargtypel2w,wbadinitl,wvarhidemem'],
     'win32': [],
+    'mingw32': ['-Wno-write-strings'],
     'freebsd7': ['-fno-strict-aliasing', '-Wno-write-strings'],
 }
 
@@ -74,6 +88,7 @@ DEBUG_CFLAGS = {
     'linux2': ['-O0', '-g', '-DDEBUG'],
     'sunos5': ['-DDEBUG'],
     'win32': ['/Od', '/DDEBUG'],
+    'mingw32': ['-O0', '-g', '-DDEBUG'],
     'freebsd7': ['-O0', '-g', '-DDEBUG'],
 }
 
@@ -94,6 +109,7 @@ LFLAGS = {
                '-L%(sunos5)s/jre/lib/i386/client' %(JDK), '-ljvm',
                '-R%(sunos5)s/jre/lib/i386:%(sunos5)s/jre/lib/i386/client' %(JDK)],
     'win32': ['/LIBPATH:%(win32)s/lib' %(JDK), 'jvm.lib'],
+    'mingw32': ['-L%(mingw32)s/lib' %(JDK), '-ljvm'],
     'freebsd7': ['-L%(freebsd7)s/jre/lib/i386' %(JDK), '-ljava', '-lverify',
                  '-L%(freebsd7)s/jre/lib/i386/client' %(JDK), '-ljvm',
                  '-Wl,-rpath=%(freebsd7)s/jre/lib/i386:%(freebsd7)s/jre/lib/i386/client'
%(JDK)],
@@ -107,7 +123,8 @@ JAVAC = {
     'ipod': ['jikes', '-cp', '/usr/share/classpath/glibj.zip'],
     'linux2': ['javac'],
     'sunos5': ['javac'],
-    'win32': ['javac.exe'],
+    'win32': ['%(win32)s/bin/javac.exe' % (JDK)],
+    'mingw32': ['%(mingw32)s/bin/javac.exe' % (JDK)],
     'freebsd7': ['javac'],
 }
         



Mime
View raw message