|
5 | 5 | from kcl_lib.bootstrap import ( |
6 | 6 | KCLVM_CLI_INSTALL_PATH_ENV_VAR, |
7 | 7 | KCLVM_CLI_BIN_PATH_ENV_VAR, |
8 | | - KCLVM_CLI_USE_RELEASE_ENV_VAR, |
| 8 | + KCLVM_CLI_USE_TEST_ENV_VAR, |
9 | 9 | lib_full_name, |
10 | 10 | install_kclvm, |
11 | 11 | ) |
@@ -104,23 +104,24 @@ def __init__(self): |
104 | 104 | self._dir = tempfile.TemporaryDirectory() |
105 | 105 | env_path = os.environ.get(KCLVM_CLI_BIN_PATH_ENV_VAR) |
106 | 106 | env_install_path = os.environ.get(KCLVM_CLI_INSTALL_PATH_ENV_VAR) |
107 | | - env_use_release = os.environ.get(KCLVM_CLI_USE_RELEASE_ENV_VAR) |
| 107 | + env_use_test = os.environ.get(KCLVM_CLI_USE_TEST_ENV_VAR) |
108 | 108 | if env_path: |
109 | 109 | self.lib = ctypes.CDLL(os.path.join(env_path, lib_full_name())) |
110 | 110 | elif env_install_path: |
111 | 111 | install_kclvm(env_install_path) |
112 | 112 | self.lib = ctypes.CDLL( |
113 | 113 | os.path.join(env_install_path, "bin", lib_full_name()) |
114 | 114 | ) |
115 | | - elif env_use_release: |
116 | | - # The release lib is located at "kcl_lib/lib/" |
117 | | - lib_path = LIB_ROOT.joinpath("lib") |
118 | | - os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = str(lib_path) |
119 | | - self.lib = ctypes.CDLL(str(lib_path.joinpath(lib_full_name()))) |
120 | | - else: |
| 115 | + # Default test cases |
| 116 | + elif env_use_test: |
121 | 117 | # Install temp path. |
122 | 118 | install_kclvm(self._dir.name) |
123 | 119 | self.lib = ctypes.CDLL(self._dir.name + "/bin/" + lib_full_name()) |
| 120 | + else: |
| 121 | + # The release lib is located at "kcl_lib/bin/" |
| 122 | + lib_path = LIB_ROOT.joinpath("bin") |
| 123 | + os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = str(lib_path) |
| 124 | + self.lib = ctypes.CDLL(str(lib_path.joinpath(lib_full_name()))) |
124 | 125 | # Assuming the shared library exposes a function `kclvm_service_new` |
125 | 126 | self.lib.kclvm_service_new.argtypes = [ctypes.c_uint64] |
126 | 127 | self.lib.kclvm_service_new.restype = ctypes.c_void_p |
|
0 commit comments