diff --git a/YAMS-LIB/YAMS-LIB.csproj b/YAMS-LIB/YAMS-LIB.csproj index 495ac4a..29904cb 100644 --- a/YAMS-LIB/YAMS-LIB.csproj +++ b/YAMS-LIB/YAMS-LIB.csproj @@ -1,7 +1,7 @@ - 2.9.0-rc2 + 2.9.0-rc3 net8.0 enable enable diff --git a/am2r_yams/wrapper.py b/am2r_yams/wrapper.py index fafcc37..bf29ddb 100644 --- a/am2r_yams/wrapper.py +++ b/am2r_yams/wrapper.py @@ -15,8 +15,41 @@ # 2. While we figured out how to deal with non system installations via the DOTNET_ROOT env var, # should we also provide a way to just pass a `dotnet_root` param to the wrapper which gets # passed to pythonnet? +dotnet_os = "unknown" +dotnet_arch = "unknown" +system = platform.system() +if system == "Windows": + dotnet_os = "win" +elif system == "Darwin": + dotnet_os = "osx" +elif system == "Linux": + dotnet_os = "linux" # Might break for musl, I dont care. +else: + raise ValueError("Couldn't determine the OS handle for dotnet cleanup!") + +arch = platform.machine() +if arch == "AMD64" or arch == "x86_64": + dotnet_arch = "x64" +elif arch == "arm64" or arch == "aarch64": + dotnet_arch = "arm64" +else: + raise ValueError("Couldn't determine the architecture handle for dotnet cleanup!") + +dotnet_rid = dotnet_os + "-" + dotnet_arch + yams_path = os.fspath(Path(__file__).with_name(name="yams")) sys.path.append(yams_path) +for os_dir in Path(__file__).parent.joinpath("yams", "runtimes").iterdir(): + if not os_dir.is_dir(): + continue + if os_dir.name != dotnet_rid: + continue + + for dll in os_dir.iterdir(): + if not dll.is_file(): + continue + sys.path.append(os.fspath(dll)) + from pythonnet import load, unload diff --git a/pyproject.toml b/pyproject.toml index 3b6aefb..04334e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "am2r_yams" -version = "2.9.0-rc2" +version = "2.9.0-rc3" authors = [ {name = "Miepee"}, ]