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 14:45:30 UTC

svn commit: r1514988 - in /lucene/pylucene/trunk/jcc: ./ CHANGES _jcc/java/lang/reflect/Method.cpp _jcc/java/lang/reflect/Method.h helpers/darwin.py jcc/cpp.py setup.py

Author: vajda
Date: Sat Aug 17 12:45:30 2013
New Revision: 1514988

URL: http://svn.apache.org/r1514988
Log:
merged 4.3 branch changes

Modified:
    lucene/pylucene/trunk/jcc/   (props changed)
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h
    lucene/pylucene/trunk/jcc/helpers/darwin.py
    lucene/pylucene/trunk/jcc/jcc/cpp.py
    lucene/pylucene/trunk/jcc/setup.py   (contents, props changed)

Propchange: lucene/pylucene/trunk/jcc/
------------------------------------------------------------------------------
  Merged /lucene/pylucene/branches/pylucene_4_3/jcc:r1514971-1514986

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Sat Aug 17 12:45:30 2013
@@ -1,3 +1,9 @@
+Version 2.16 -> 2.17
+--------------------
+ - added support for detecting and running with Oracle JDK 7 on Mac OS X
+ - added skipping of synthetic methods
+ - 
+
 Version 2.15 -> 2.16
 --------------------
  - improved parseArgs() to let nested arrays pass through

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.cpp?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.cpp Sat Aug 17 12:45:30 2013
@@ -36,6 +36,8 @@ namespace java {
                 mid_getParameterTypes,
                 mid_getExceptionTypes,
                 mid_getDeclaringClass,
+                mid_isSynthetic,
+                mid_isBridge,
 #ifdef _java_generics
                 mid_getTypeParameters,
                 mid_getGenericExceptionTypes,
@@ -76,6 +78,12 @@ namespace java {
                     _mids[mid_getDeclaringClass] =
                         env->getMethodID(cls, "getDeclaringClass",
                                          "()Ljava/lang/Class;");
+                    _mids[mid_isSynthetic] =
+                        env->getMethodID(cls, "isSynthetic",
+                                         "()Z");
+                    _mids[mid_isBridge] =
+                        env->getMethodID(cls, "isBridge",
+                                         "()Z");
 #ifdef _java_generics
                     _mids[mid_getTypeParameters] =
                         env->getMethodID(cls, "getTypeParameters",
@@ -133,6 +141,16 @@ namespace java {
                 return Class(env->callObjectMethod(this$, _mids[mid_getDeclaringClass]));
             }
 
+            bool Method::isSynthetic() const
+            {
+                return env->callBooleanMethod(this$, _mids[mid_isSynthetic]);
+            }
+
+            bool Method::isBridge() const
+            {
+                return env->callBooleanMethod(this$, _mids[mid_isBridge]);
+            }
+
 #ifdef _java_generics
             JArray<TypeVariable> Method::getTypeParameters() const
             {
@@ -175,6 +193,8 @@ namespace java {
             static PyObject *t_Method_getParameterTypes(t_Method *self);
             static PyObject *t_Method_getExceptionTypes(t_Method *self);
             static PyObject *t_Method_getDeclaringClass(t_Method *self);
+            static PyObject *t_Method_isSynthetic(t_Method *self);
+            static PyObject *t_Method_isBridge(t_Method *self);
 #ifdef _java_generics
             static PyObject *t_Method_getTypeParameters(t_Method *self);
             static PyObject *t_Method_getGenericExceptionTypes(t_Method *self);
@@ -191,6 +211,8 @@ namespace java {
                 DECLARE_METHOD(t_Method, getParameterTypes, METH_NOARGS),
                 DECLARE_METHOD(t_Method, getExceptionTypes, METH_NOARGS),
                 DECLARE_METHOD(t_Method, getDeclaringClass, METH_NOARGS),
+                DECLARE_METHOD(t_Method, isSynthetic, METH_NOARGS),
+                DECLARE_METHOD(t_Method, isBridge, METH_NOARGS),
 #ifdef _java_generics
                 DECLARE_METHOD(t_Method, getTypeParameters, METH_NOARGS),
                 DECLARE_METHOD(t_Method, getGenericExceptionTypes, METH_NOARGS),
@@ -265,6 +287,22 @@ namespace java {
                 return t_Class::wrap_Object(cls);
             }
 
+            static PyObject *t_Method_isSynthetic(t_Method *self)
+            {
+                int isSynthetic;
+
+                OBJ_CALL(isSynthetic = self->object.isSynthetic());
+                Py_RETURN_BOOL(isSynthetic);
+            }
+
+            static PyObject *t_Method_isBridge(t_Method *self)
+            {
+                int isBridge;
+
+                OBJ_CALL(isBridge = self->object.isBridge());
+                Py_RETURN_BOOL(isBridge);
+            }
+
 #ifdef _java_generics
             static PyObject *t_Method_getTypeParameters(t_Method *self)
             {

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h Sat Aug 17 12:45:30 2013
@@ -46,6 +46,8 @@ namespace java {
                 JArray<Class> getParameterTypes() const;
                 JArray<Class> getExceptionTypes() const;
                 Class getDeclaringClass() const;
+                bool isSynthetic() const;
+                bool isBridge() const;
 #ifdef _java_generics
                 JArray<TypeVariable> getTypeParameters() const;
                 JArray<Type> getGenericExceptionTypes() const;

Modified: lucene/pylucene/trunk/jcc/helpers/darwin.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/helpers/darwin.py?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/helpers/darwin.py (original)
+++ lucene/pylucene/trunk/jcc/helpers/darwin.py Sat Aug 17 12:45:30 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/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Sat Aug 17 12:45:30 2013
@@ -776,6 +776,8 @@ def header(env, out, cls, typeset, packa
     methods = {}
     protectedMethods = []
     for method in cls.getDeclaredMethods():
+        if method.isSynthetic():
+            continue
         modifiers = method.getModifiers()
         if (Modifier.isPublic(modifiers) or
             method.getName() in listedMethodNames):

Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=1514988&r1=1514987&r2=1514988&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Sat Aug 17 12:45:30 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'],

Propchange: lucene/pylucene/trunk/jcc/setup.py
------------------------------------------------------------------------------
  Merged /lucene/pylucene/branches/pylucene_4_3/jcc/setup.py:r1514971-1514986