From ad6ba9a7e369d709b7008c7990d2b25341daa443 Mon Sep 17 00:00:00 2001 From: knappersfy Date: Tue, 7 Jul 2026 11:34:46 +0200 Subject: [PATCH] fix macos installation bug --- docs/changelog.md | 3 +++ pyproject.toml | 2 +- pythermogis/constants.py | 2 +- pythermogis/jvm.py | 11 +++++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index d819c8d..0d6d5b0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,8 @@ # Change log +## v3.0.2 (06-7-2026) +- Fix installation issues for macOS users with a silicon chip. + ## v3.0.1 (06-7-2026) - Added pressureDifferenceGradient as property. - Implemented detailed SDE classes diff --git a/pyproject.toml b/pyproject.toml index 2fe7266..b91aa86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pythermogis" -version = "3.0.1" +version = "3.0.2" description = "This repository is used as a python API for the ThermoGIS Doublet simulations" authors = [ { name = "Hen Brett", email = "hen.brett@tno.nl" }, diff --git a/pythermogis/constants.py b/pythermogis/constants.py index 3d92a6f..f1507af 100644 --- a/pythermogis/constants.py +++ b/pythermogis/constants.py @@ -9,7 +9,7 @@ os_name = platform.system() if os_name == "Linux": JVM17_DLL_PATH = JVM17_PATH / "jdk17" / "lib" / "server" / "libjvm.so" elif os_name == "Darwin": # mac - JVM17_DLL_PATH = JVM17_PATH / "jdk17" / "lib" / "server" / "libjvm.dylib" + JVM17_DLL_PATH = JVM17_PATH / "jdk17" / "Contents" / "Home" / "lib" / "server" / "libjvm.dylib" elif os_name == "Windows": JVM17_DLL_PATH = JVM17_PATH / "jdk17" / "bin" / "server" / "jvm.dll" else: diff --git a/pythermogis/jvm.py b/pythermogis/jvm.py index 6000ab7..f89c067 100644 --- a/pythermogis/jvm.py +++ b/pythermogis/jvm.py @@ -1,8 +1,10 @@ import faulthandler +import platform import shutil import jdk import jpype +from jdk.enums import Architecture from pythermogis.constants import JVM17_DLL_PATH, JVM17_PATH, THERMOGIS_JAR_PATH @@ -26,8 +28,13 @@ def install_jvm(): # create path JVM17_PATH.mkdir(parents=True, exist_ok=True) - # Installs a Corretto build of Java 17 JDK - jdk.install("17", vendor="Corretto", path=JVM17_PATH) + # This arch line was added to fix an issue people with a mac with the new + # silicon chip had. The bug is actually an upstream bug in the jdk package, + # but this package is unmaintained. thats why we now added this injection of arch + # value in case of a macOS. For other os, it still works, as the package correctly + # handles those. + arch = Architecture.AARCH64 if platform.machine() == "arm64" else None + jdk.install("17", vendor="Corretto", arch=arch, path=JVM17_PATH) # search for the path of the installed JDK, it can be different depending on the # version number -- GitLab