1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From: Alastair McKinstry <mckinstry@debian.org>
Date: Thu, 18 Nov 2021 21:38:04 -0400
Subject: Add libjvm.so to path
Last-Updated: 2019-07-17
Forwarded: not-needed
---
jpyutil.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
--- a/jpyutil.py
+++ b/jpyutil.py
@@ -56,6 +56,9 @@
ch.setFormatter(formatter)
logger.addHandler(ch)
+# Uncomment for debugging
+# logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
+
JDK_HOME_VARS = ('JPY_JAVA_HOME', 'JPY_JDK_HOME', 'JAVA_HOME', 'JDK_HOME',)
JRE_HOME_VARS = ('JPY_JAVA_HOME', 'JPY_JDK_HOME', 'JPY_JRE_HOME', 'JAVA_HOME', 'JDK_HOME', 'JRE_HOME', 'JAVA_JRE')
JVM_LIB_NAME = 'jvm'
@@ -271,6 +274,18 @@
new_dirs.append(new_dir)
return new_dirs
+def get_arch():
+ """ Get arch name on Debian """
+ from subprocess import check_output
+ # arch = 'amd64' if PYTHON_64BIT else 'i386'
+ arch = check_output(['dpkg-architecture','-q', 'DEB_BUILD_ARCH_CPU']).strip()
+ if type(arch) != str: # python3
+ arch = arch.decode('utf-8')
+ other_names = { 'ppc64el': 'ppc64le', 'arm64' : 'aarch64',
+ 'powerpc' : 'ppc', 'sparc64' : 'sparcv9' }
+ if arch in other_names:
+ arch = other_names[arch]
+ return arch
def _find_jvm_dll_file(java_home_dir):
logger.debug("Searching for JVM shared library file in %s" % repr(java_home_dir))
@@ -284,6 +299,9 @@
search_dirs += _get_jvm_lib_dirs(jre_home_dir)
search_dirs += _get_jvm_lib_dirs(java_home_dir)
+ arch = get_arch()
+ search_dirs += "/usr/lib/jvm/default-java/lib/server"
+
search_dirs = _add_paths_if_exists([], *search_dirs)
if platform.system() == 'Windows':
|