You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2013/08/17 11:40:10 UTC

svn commit: r1514971 - in /lucene/pylucene/branches/pylucene_4_3/jcc: CHANGES helpers/darwin.py setup.py

Author: vajda
Date: Sat Aug 17 09:40:10 2013
New Revision: 1514971

URL: http://svn.apache.org/r1514971
Log:
 - added support for detecting and running with Oracle JDK 7 on Mac OS X

Modified:
    lucene/pylucene/branches/pylucene_4_3/jcc/CHANGES
    lucene/pylucene/branches/pylucene_4_3/jcc/helpers/darwin.py
    lucene/pylucene/branches/pylucene_4_3/jcc/setup.py

Modified: lucene/pylucene/branches/pylucene_4_3/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_4_3/jcc/CHANGES?rev=1514971&r1=1514970&r2=1514971&view=diff
==============================================================================
--- lucene/pylucene/branches/pylucene_4_3/jcc/CHANGES (original)
+++ lucene/pylucene/branches/pylucene_4_3/jcc/CHANGES Sat Aug 17 09:40:10 2013
@@ -1,3 +1,8 @@
+Version 2.16 -> 2.17
+--------------------
+ - added support for detecting and running with Oracle JDK 7 on Mac OS X
+ - 
+
 Version 2.15 -> 2.16
 --------------------
  - improved parseArgs() to let nested arrays pass through

Modified: lucene/pylucene/branches/pylucene_4_3/jcc/helpers/darwin.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_4_3/jcc/helpers/darwin.py?rev=1514971&r1=1514970&r2=1514971&view=diff
==============================================================================
--- lucene/pylucene/branches/pylucene_4_3/jcc/helpers/darwin.py (original)
+++ lucene/pylucene/branches/pylucene_4_3/jcc/helpers/darwin.py Sat Aug 17 09:40:10 2013
@@ -12,22 +12,43 @@
 
 import sys, os
 
-global JAVAHOME
+global JAVAHOME, JAVAFRAMEWORKS
 JAVAHOME = None
+JAVAFRAMEWORKS = None
 
 if sys.platform == "darwin":
 
     # figure out where the JDK lives
+    from subprocess import Popen, PIPE
+
+    try:
+        args = ['/usr/libexec/java_home']
+        process = Popen(args, stdout=PIPE, stderr=PIPE)
+    except Exception, e:
+        print >>sys.stderr, "%s: %s" %(e, args)
+    else:
+        process.wait()
+        if process.returncode == 0:
+            _path = process.stdout.read().strip()
+            if os.path.exists(os.path.join(_path, "include", "jni.h")):
+                JAVAHOME = _path
+                print >>sys.stderr, 'found JAVAHOME =', JAVAHOME
+        else:
+            print >>sys.stderr, process.stderr.read()
+
+    # figure out where the JDK Frameworks lives
     import platform, re
     _os_version = re.match("[0-9]+\.[0-9]+", platform.mac_ver()[0]).group(0)
 
     # this is where Apple says we should look for headers
     _path = "/System/Library/Frameworks/JavaVM.framework"
     if os.path.exists(os.path.join(_path, "Headers", "jni.h")):
-        JAVAHOME = _path
+        JAVAFRAMEWORKS = _path
+        print >>sys.stderr, 'found JAVAFRAMEWORKS =', JAVAFRAMEWORKS
     else:
         # but their updates don't always match their documentation, 
         # so look up the same path in the OS's /Developer tree
         _path = "/Developer/SDKs/MacOSX%s.sdk%s" %(_os_version, _path)
         if os.path.exists(os.path.join(_path, "Headers", "jni.h")):
-            JAVAHOME = _path
+            JAVAFRAMEWORKS = _path
+            print >>sys.stderr, 'found JAVAFRAMEWORKS =', JAVAFRAMEWORKS

Modified: lucene/pylucene/branches/pylucene_4_3/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/branches/pylucene_4_3/jcc/setup.py?rev=1514971&r1=1514970&r2=1514971&view=diff
==============================================================================
--- lucene/pylucene/branches/pylucene_4_3/jcc/setup.py (original)
+++ lucene/pylucene/branches/pylucene_4_3/jcc/setup.py Sat Aug 17 09:40:10 2013
@@ -37,19 +37,22 @@ else:
 
 if platform in ("win32", "mingw32"):
     try:
+        JAVAFRAMEWORKS = None
         from helpers.windows import JAVAHOME
     except ImportError:
         JAVAHOME = None
 elif platform in ("darwin",):
     try:
-        from helpers.darwin import JAVAHOME
+        from helpers.darwin import JAVAHOME, JAVAFRAMEWORKS
     except ImportError:
         JAVAHOME = None
+        JAVAFRAMEWORKS = None
 else:
     JAVAHOME = None
+    JAVAFRAMEWORKS = None
 
 JDK = {
-    'darwin': JAVAHOME,
+    'darwin': JAVAHOME or JAVAFRAMEWORKS,
     'ipod': '/usr/include/gcc',
     'linux2': '/usr/lib/jvm/java-7-openjdk-amd64',
     'sunos5': '/usr/jdk/instances/jdk1.6.0',
@@ -81,7 +84,9 @@ running setup.py.
 
 
 INCLUDES = {
-    'darwin': ['%(darwin)s/Headers' %(JDK)],
+    'darwin/frameworks': ['%(darwin)s/Headers' %(JDK)],
+    'darwin/home': ['%(darwin)s/include' %(JDK),
+                    '%(darwin)s/include/darwin' %(JDK)],
     'ipod': ['%(ipod)s/darwin/default' %(JDK)],
     'linux2': ['%(linux2)s/include' %(JDK),
                '%(linux2)s/include/linux' %(JDK)],
@@ -118,7 +123,11 @@ DEBUG_CFLAGS = {
 }
 
 LFLAGS = {
-    'darwin': ['-framework', 'JavaVM'],
+    'darwin/frameworks': ['-framework', 'JavaVM'],
+    'darwin/home': ['-L%(darwin)s/jre/lib' %(JDK), '-ljava',
+                    '-L%(darwin)s/jre/lib/server' %(JDK), '-ljvm',
+                    '-Wl,-rpath', '-Wl,%(darwin)s/jre/lib' %(JDK),
+                    '-Wl,-rpath', '-Wl,%(darwin)s/jre/lib/server' %(JDK)],
     'ipod': ['-ljvm', '-lpython%s.%s' %(sys.version_info[0:2]),
              '-L/usr/lib/gcc/arm-apple-darwin9/4.0.1'],
     'linux2/i386': ['-L%(linux2)s/jre/lib/i386' %(JDK), '-ljava',
@@ -147,6 +156,13 @@ IMPLIB_LFLAGS = {
 
 if platform == 'linux2':
     LFLAGS['linux2'] = LFLAGS['linux2/%s' %(machine)]
+elif platform == 'darwin':
+    if JAVAHOME is not None:
+        INCLUDES['darwin'] = INCLUDES['darwin/home']
+        LFLAGS['darwin'] = LFLAGS['darwin/home']
+    elif JAVAFRAMEWORKS is not None:
+        INCLUDES['darwin'] = INCLUDES['darwin/frameworks']
+        LFLAGS['darwin'] = LFLAGS['darwin/frameworks']
 
 JAVAC = {
     'darwin': ['javac', '-source', '1.5', '-target', '1.5'],