Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dll conflict #247

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions python/ionpy/Builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import ctypes
from typing import Optional
from ctypes.util import find_library
import os

from .native import (
c_ion_builder_t,
Expand All @@ -20,6 +17,7 @@

ion_builder_run,
ion_builder_run_with_port_map,

)

from .Node import Node
Expand Down Expand Up @@ -49,10 +47,7 @@ def set_target(self, target: str) -> 'Builder':
return self

def with_bb_module(self, path: str) -> 'Builder':
if os.name == 'nt':
ret = ion_builder_with_bb_module(self.obj, str(find_library(path)).encode())
else:
ret = ion_builder_with_bb_module(self.obj, path.encode())
ret = ion_builder_with_bb_module(self.obj,path.encode())
if ret != 0:
raise Exception('Invalid operation')

Expand Down
8 changes: 3 additions & 5 deletions python/ionpy/native.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import ctypes
from ctypes.util import find_library

import os
import platform

pre_built_path = os.path.join(os.path.dirname(__file__), 'module')

if platform.system() == 'Windows':
ion_core_module = find_library('ion-core.dll')
ion_core_module = os.path.join(pre_built_path, 'windows/ion-core.dll')
ion_bb_module = os.path.join(pre_built_path, 'windows/ion-bb.dll')
elif platform.system() == 'Darwin':
ion_core_module = os.path.join(pre_built_path, 'macos/libion-core.dylib')
ion_bb_module = os.path.join(pre_built_path, 'macos/libion-bb.dylib')
Expand All @@ -19,8 +18,7 @@
# ion-core.dll must be in a directory listed in %PATH%.
# libion-core.dylib must be in a directory listed in $DYLD_LIBRARY_PATH.
ion_core = ctypes.cdll.LoadLibrary(ion_core_module)
if not platform.system() == 'Windows':
ion_bb = ctypes.cdll.LoadLibrary(ion_bb_module)
ion_bb = ctypes.cdll.LoadLibrary(ion_bb_module)

class c_ion_type_t(ctypes.Structure):
_fields_ = [
Expand Down
2 changes: 1 addition & 1 deletion python/ionpy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.0"
__version__ = "1.6.0"
Loading