Skip to content

Commit 57e3ea0

Browse files
authored
Move get_cpu guessing into _possible_lib_location (#626)
1 parent fe46b03 commit 57e3ea0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

jnius/env.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,9 @@ def get_jnius_lib_location(self):
165165
)
166166
return libjvm_override_path
167167

168-
cpu = get_cpu()
169168
platform = self.platform
170-
log.debug(
171-
"looking for libjvm to initiate pyjnius, cpu is %s, platform is %s",
172-
cpu, platform
173-
)
174-
lib_locations = self._possible_lib_locations(cpu)
169+
log.debug("looking for libjvm to initiate pyjnius, platform is %s", platform)
170+
lib_locations = self._possible_lib_locations()
175171
for location in lib_locations:
176172
full_lib_location = join(self.home, location)
177173
if exists(full_lib_location):
@@ -193,7 +189,7 @@ def get_jnius_lib_location(self):
193189
% [join(self.home, loc) for loc in lib_locations]
194190
)
195191

196-
def _possible_lib_locations(self, cpu):
192+
def _possible_lib_locations(self):
197193
'''
198194
Returns a list of relative possible locations for the Java library.
199195
Used by the default implementation of get_jnius_lib_location()
@@ -223,11 +219,16 @@ def _get_platform_include_dir(self):
223219
else:
224220
return join(self.home, 'include', 'linux')
225221

226-
def _possible_lib_locations(self, cpu):
222+
def _possible_lib_locations(self):
227223
root = self.home
228224
if root.endswith('jre'):
229225
root = root[:-3]
230226

227+
cpu = get_cpu()
228+
log.debug(
229+
f"Platform {self.platform} may need cpu in path to find libjvm, which is: {cpu}"
230+
)
231+
231232
return [
232233
'lib/server/libjvm.so',
233234
'jre/lib/{}/default/libjvm.so'.format(cpu),
@@ -239,7 +240,7 @@ class MacOsXJavaLocation(UnixJavaLocation):
239240
def _get_platform_include_dir(self):
240241
return join(self.home, 'include', 'darwin')
241242

242-
def _possible_lib_locations(self, cpu):
243+
def _possible_lib_locations(self):
243244
if '1.6' in self.home:
244245
return ['../Libraries/libjvm.dylib'] # TODO what should this be resolved to?
245246

0 commit comments

Comments
 (0)