Author: rhuijben
Date: Wed Jul 21 10:26:48 2010
New Revision: 966167

URL: http://svn.apache.org/viewvc?rev=966167&view=rev
Log:
Allow setting an explicit jdk version to use for building on Windows. This
allows building with a 64 bit JDK when using a 32 bit python (or the
other way around) on Windows x64.

* gen-make.py
  (_usage_exit): Show help for --with-jdk.
  (global): Parse 'with-jdk' option.

* build/generator/gen_win.py
  (parse_options): Set jdk_path to None and fill
    from options.
  (_find_jdk): If already set, just print the jdk path.

Modified:
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/gen-make.py

Modified: subversion/trunk/build/generator/gen_win.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=966167&r1=966166&r2=966167&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Wed Jul 21 10:26:48 2010
@@ -80,6 +80,7 @@ class GeneratorBase(gen_base.GeneratorBa
     self.libintl_path = None
     self.zlib_path = 'zlib'
     self.openssl_path = None
+    self.jdk_path = None
     self.junit_path = None
     self.swig_path = None
     self.vs_version = '2002'
@@ -127,6 +128,8 @@ class GeneratorBase(gen_base.GeneratorBa
       elif opt == '--with-libintl':
         self.libintl_path = val
         self.enable_nls = 1
+      elif opt == '--with-jdk':
+        self.jdk_path = val
       elif opt == '--with-junit':
         self.junit_path = val
       elif opt == '--with-zlib':
@@ -1260,39 +1263,41 @@ class WinGeneratorBase(GeneratorBase):
       pass
 
   def _find_jdk(self):
-    self.jdk_path = None
-    jdk_ver = None
-    try:
+    if not self.jdk_path:
+      jdk_ver = None
       try:
-        # Python >=3.0
-        import winreg
-      except ImportError:
-        # Python <3.0
-        import _winreg as winreg
-      key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
+        try:
+          # Python >=3.0
+          import winreg
+        except ImportError:
+          # Python <3.0
+          import _winreg as winreg
+        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
                            r"SOFTWARE\JavaSoft\Java Development Kit")
-      # Find the newest JDK version.
-      num_values = winreg.QueryInfoKey(key)[1]
-      for i in range(num_values):
-        (name, value, key_type) = winreg.EnumValue(key, i)
-        if name == "CurrentVersion":
-          jdk_ver = value
-          break
-
-      # Find the JDK path.
-      if jdk_ver is not None:
-        key = winreg.OpenKey(key, jdk_ver)
+        # Find the newest JDK version.
         num_values = winreg.QueryInfoKey(key)[1]
         for i in range(num_values):
           (name, value, key_type) = winreg.EnumValue(key, i)
-          if name == "JavaHome":
-            self.jdk_path = value
+          if name == "CurrentVersion":
+            jdk_ver = value
             break
-      winreg.CloseKey(key)
-    except (ImportError, EnvironmentError):
-      pass
-    if self.jdk_path:
-      print("Found JDK version %s in %s\n" % (jdk_ver, self.jdk_path))
+
+        # Find the JDK path.
+        if jdk_ver is not None:
+          key = winreg.OpenKey(key, jdk_ver)
+          num_values = winreg.QueryInfoKey(key)[1]
+          for i in range(num_values):
+            (name, value, key_type) = winreg.EnumValue(key, i)
+            if name == "JavaHome":
+              self.jdk_path = value
+              break
+        winreg.CloseKey(key)
+      except (ImportError, EnvironmentError):
+        pass
+      if self.jdk_path:
+        print("Found JDK version %s in %s\n" % (jdk_ver, self.jdk_path))
+    else:
+      print("Using JDK in %s\n" % (self.jdk_path))
 
   def _find_swig(self):
     # Require 1.3.24. If not found, assume 1.3.25.

Modified: subversion/trunk/gen-make.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/gen-make.py?rev=966167&r1=966166&r2=966167&view=diff
==============================================================================
--- subversion/trunk/gen-make.py (original)
+++ subversion/trunk/gen-make.py Wed Jul 21 10:26:48 2010
@@ -167,6 +167,9 @@ def _usage_exit():
   print("           tell neon to look for ZLib headers and")
   print("           libs in DIR")
   print("")
+  print("  --with-jdk=DIR")
+  print("           look for the java development kit here")
+  print("")
   print("  --with-junit=DIR")
   print("           look for the junit jar here")
   print("           junit is for testing the java bindings")
@@ -241,6 +244,7 @@ if __name__ == '__main__':
                             'with-libintl=',
                             'with-openssl=',
                             'with-zlib=',
+                            'with-jdk=',
                             'with-junit=',
                             'with-swig=',
                             'with-sqlite=',


Reply via email to