Skip to content

Commit 1ec1897

Browse files
committed
Fix libary location for Java >=9. Fix kivy#304
1 parent 5e19dbe commit 1ec1897

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

setup.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
except ImportError:
1313
import subprocess
1414
from os import environ
15-
from os.path import dirname, join, exists
15+
from os.path import dirname, join, exists, isdir
1616
import sys
1717
from platform import machine
1818
from setup_sdist import SETUP_KWARGS
@@ -119,6 +119,13 @@ def compile_native_invocation_handler(*possible_homes):
119119
)]
120120
else:
121121
LIB_LOCATION = 'jre/lib/server/libjvm.dylib'
122+
FULL_LIB_LOCATION = join(JRE_HOME.decode(), LIB_LOCATION)
123+
124+
if not exists(FULL_LIB_LOCATION):
125+
# In that case, the Java version is very likely >=9.
126+
# So we need to modify the `libjvm.so` path.
127+
LIB_LOCATION = 'lib/server/libjvm.dylib'
128+
122129
INCLUDE_DIRS = [
123130
'{0}/include'.format(FRAMEWORK),
124131
'{0}/include/darwin'.format(FRAMEWORK)
@@ -180,6 +187,12 @@ def compile_native_invocation_handler(*possible_homes):
180187
else:
181188
INCL_DIR = join(JDK_HOME, 'include', 'linux')
182189
LIB_LOCATION = 'jre/lib/{}/server/libjvm.so'.format(CPU)
190+
FULL_LIB_LOCATION = join(JRE_HOME.decode(), LIB_LOCATION)
191+
192+
if not exists(FULL_LIB_LOCATION):
193+
# In that case, the Java version is very likely >=9.
194+
# So we need to modify the `libjvm.so` path.
195+
LIB_LOCATION = 'lib/server/libjvm.so'
183196

184197
INCLUDE_DIRS = [
185198
join(JDK_HOME, 'include'),

0 commit comments

Comments
 (0)