Skip to content

Commit

Permalink
Merge pull request #42 from kcl-lang/fix-kcl-lib-install
Browse files Browse the repository at this point in the history
fix: kcl lib install
  • Loading branch information
Peefy authored Feb 26, 2024
2 parents 40624b7 + 0bbe529 commit 5bbae3b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/kcl_lib/api/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ def __init__(self):
install_kclvm(env_install_path)
self.lib = ctypes.CDLL(os.path.join(env_install_path, lib_full_name()))
else:
self.lib = ctypes.CDLL(os.path.join(lib_path(), lib_full_name()))
# Set the kcl lib and open it.
path = lib_path()
path_env = os.environ.get("PATH", "")
bin_path_str = str(path)
new_path_env = f"{path_env}{os.pathsep}{bin_path_str}"
os.environ["PATH"] = new_path_env
os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = bin_path_str
self.lib = ctypes.CDLL(os.path.join(path, lib_full_name()))
# Assuming the shared library exposes a function `kclvm_service_new`
self.lib.kclvm_service_new.argtypes = [ctypes.c_uint64]
self.lib.kclvm_service_new.restype = ctypes.c_void_p
Expand Down

0 comments on commit 5bbae3b

Please sign in to comment.