Author: vajda Date: Wed Apr 13 22:27:26 2022 New Revision: 1899827 URL: http://svn.apache.org/viewvc?rev=1899827&view=rev Log: preparing JCC 3.12 release
Modified: lucene/pylucene/trunk/jcc/CHANGES lucene/pylucene/trunk/jcc/jcc3/__init__.py lucene/pylucene/trunk/jcc/jcc3/__main__.py lucene/pylucene/trunk/jcc/jcc3/cpp.py lucene/pylucene/trunk/jcc/jcc3/python.py lucene/pylucene/trunk/jcc/jcc3/windows.py lucene/pylucene/trunk/jcc/setup.py Modified: lucene/pylucene/trunk/jcc/CHANGES URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/CHANGES (original) +++ lucene/pylucene/trunk/jcc/CHANGES Wed Apr 13 22:27:26 2022 @@ -1,7 +1,8 @@ -Version 3.11 -> +Version 3.11 -> 3.12 --------------------- - fixed bug with not checking presence of compiled extension directory - - + - --find-jvm-dll changed to a string from bool, defaulting to "client" + - fixed --find-jvm-dll support to use new os.add_dll_directory() for py >= 3.8 Version 3.10 -> 3.11 --------------------- Modified: lucene/pylucene/trunk/jcc/jcc3/__init__.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/__init__.py?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/__init__.py (original) +++ lucene/pylucene/trunk/jcc/jcc3/__init__.py Wed Apr 13 22:27:26 2022 @@ -16,9 +16,14 @@ import os, sys if sys.platform == 'win32': - if '--find-jvm-dll' in sys.argv: + try: + find_jvm_dll = sys.argv[sys.argv.index('--find_jvm_dll') + 1] + except: + find_jvm_dll = "client" if sys.version_info >= (3, 8) else None + + if find_jvm_dll: from .windows import add_jvm_dll_directory_to_path - add_jvm_dll_directory_to_path() + add_jvm_dll_directory_to_path(find_jvm_dll) from jcc.config import SHARED if SHARED: Modified: lucene/pylucene/trunk/jcc/jcc3/__main__.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/__main__.py?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/__main__.py (original) +++ lucene/pylucene/trunk/jcc/jcc3/__main__.py Wed Apr 13 22:27:26 2022 @@ -75,9 +75,11 @@ 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 + --find-jvm-dll KIND - Windows only: extract the directory containing jvm.dll from the registry and append it to the - Path at runtime + DLL Path at runtime; one of 'client', 'server'. + With python 3.8 and above, --find_jvm_dll defaults + to 'client'. Actions: --build - generate the wrapper and compile it Modified: lucene/pylucene/trunk/jcc/jcc3/cpp.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/cpp.py?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/cpp.py (original) +++ lucene/pylucene/trunk/jcc/jcc3/cpp.py Wed Apr 13 22:27:26 2022 @@ -449,7 +449,7 @@ def jcc(args): dist = False wheel = False wininst = False - find_jvm_dll = False + find_jvm_dll = "client" if sys.version_info >= (3, 8) else None compiler = None generics = hasattr(_jcc3, "Type") arch = [] @@ -575,7 +575,8 @@ def jcc(args): elif arg == '--no-generics': generics = False elif arg == '--find-jvm-dll': - find_jvm_dll = True + i += 1 + find_jvm_dll = args[i] elif arg == '--resources': i += 1 resources.append(args[i]) Modified: lucene/pylucene/trunk/jcc/jcc3/python.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/python.py?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/python.py (original) +++ lucene/pylucene/trunk/jcc/jcc3/python.py Wed Apr 13 22:27:26 2022 @@ -1624,7 +1624,7 @@ def compile(env, jccPath, output, module 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, "add_jvm_dll_directory_to_path('%s')" %(find_jvm_dll)) line(out, 1, "import jcc") line(out, 0, "from . import %s", extname) else: Modified: lucene/pylucene/trunk/jcc/jcc3/windows.py URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/windows.py?rev=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/jcc3/windows.py (original) +++ lucene/pylucene/trunk/jcc/jcc3/windows.py Wed Apr 13 22:27:26 2022 @@ -32,7 +32,7 @@ class WindowsRegistry(object): self.handle.Close() -def get_jvm_dll_directory(client_or_server="client"): +def get_jvm_dll_directory_from_registry(client_or_server): jre_key = r"SOFTWARE\JavaSoft\Java Runtime Environment" jdk_key = r"SOFTWARE\JavaSoft\Java Development Kit" @@ -73,13 +73,32 @@ def get_jvm_dll_directory(client_or_serv return None -def add_jvm_dll_directory_to_path(): +def get_jvm_dll_directory_from_env(client_or_server): - path = os.environ['Path'].split(os.pathsep) - dll_path = get_jvm_dll_directory() + path = os.getenv('JCC_JDK') or os.getenv('JAVA_HOME') + if path: + # Traverse the found path to identify if there is a jvm.dll somewhere + for location in (('bin', client_or_server), + ('jre', 'bin', client_or_server)): + jvm_path = os.path.abspath(os.path.join(path, *location)) + if os.path.exists(os.path.join(jvm_path, "jvm.dll")): + return jvm_path + + return None + + +def add_jvm_dll_directory_to_path(client_or_server="client"): + + dll_path = (get_jvm_dll_directory_from_env(client_or_server) or + get_jvm_dll_directory_from_registry(client_or_server)) if dll_path is not None: - path.append(dll_path) - os.environ['Path'] = os.pathsep.join(path) + if hasattr(os, 'add_dll_directory'): # python >= 3.8 + os.add_dll_directory(dll_path) + else: + path = os.environ['Path'].split(os.pathsep) + path.append(dll_path) + os.environ['Path'] = os.pathsep.join(path) + return True 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=1899827&r1=1899826&r2=1899827&view=diff ============================================================================== --- lucene/pylucene/trunk/jcc/setup.py (original) +++ lucene/pylucene/trunk/jcc/setup.py Wed Apr 13 22:27:26 2022 @@ -12,7 +12,7 @@ import os, sys, platform, subprocess -jcc_ver = '3.11' +jcc_ver = '3.12' machine = platform.machine() using_python2 = sys.version_info < (3,)