Skip to content

Commit 73c1f3c

Browse files
committed
Fix checking the version of resources on unsupported platforms
1 parent 4f645e4 commit 73c1f3c

File tree

1 file changed

+8
-1
lines changed
  • graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources

1 file changed

+8
-1
lines changed

graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,14 @@ private static String getProperty(String prop) {
227227
@Override
228228
public String versionHash(Env env) {
229229
StringBuilder sb = new StringBuilder();
230-
for (var s : List.of(LIBGRAALPY_SHA256, LIBPYTHON_SHA256, NI_SHA256, INCLUDE_SHA256, Path.of(env.getOS().toString()).resolve(env.getCPUArchitecture().toString()).resolve(NATIVE_SHA256))) {
230+
List<Path> al = List.of(LIBGRAALPY_SHA256, LIBPYTHON_SHA256, NI_SHA256, INCLUDE_SHA256);
231+
OS os = env.getOS();
232+
CPUArchitecture cpuArchitecture = env.getCPUArchitecture();
233+
if (!os.equals(OS.UNSUPPORTED) && !cpuArchitecture.equals(CPUArchitecture.UNSUPPORTED)) {
234+
al = new ArrayList<>(al);
235+
al.add(Path.of(os.toString()).resolve(cpuArchitecture.toString()).resolve(NATIVE_SHA256));
236+
}
237+
for (var s : al) {
231238
try {
232239
sb.append(env.readResourceLines(BASE_PATH.resolve(s)).get(0).substring(0, 8));
233240
} catch (IOException | IndexOutOfBoundsException | InvalidPathException e) {

0 commit comments

Comments
 (0)