@@ -29,32 +29,25 @@ def is_dll(path: os.PathLike) -> bool:
29
29
return suffix in {'.so' , '.dll' }
30
30
31
31
32
- def install_path_to_cadet_paths (install_path : Optional [os .PathLike ]) -> (None , None , None , None ):
32
+ def install_path_to_cadet_paths (
33
+ install_path : Optional [os .PathLike ],
34
+ ) -> tuple [Optional [Path ], Optional [Path ], Optional [Path ], Optional [Path ]]:
33
35
"""
34
36
Get the correct paths (root_path, cadet_cli_path, cadet_dll_path, cadet_create_lwe_path)
35
37
from the installation path of CADET. This is extracted into a function to be used
36
38
in both the meta class and the cadet class itself.
37
39
38
40
Parameters
39
41
----------
40
- install_path : Path | os.PathLike | None
42
+ install_path : Optional[ os.PathLike]
41
43
Path to the root of the CADET installation or the executable file 'cadet-cli'.
42
44
If a file path is provided, the root directory will be inferred.
43
45
44
46
Returns
45
47
-------
46
-
47
- root_path : Path | os.PathLike | None
48
- Path to the root of the CADET installation.
49
-
50
- cadet_cli_path : Path | os.PathLike | None
51
- Path to the executable file `cadet-cli`
52
-
53
- cadet_dll_path : Path | os.PathLike | None
54
- Path to the library file `cadet.dll` or `cadet.so`
55
-
56
- cadet_create_lwe_path : Path | os.PathLike | None
57
- Path to the executable file `createLWE`
48
+ tuple[Optional[Path], Optional[Path], Optional[Path], Optional[Path]]
49
+ Tuple with CADET installation paths
50
+ (root_path, cadet_cli_path, cadet_dll_path, cadet_create_lwe_path)
58
51
"""
59
52
if install_path is None :
60
53
return None , None , None , None
@@ -95,8 +88,8 @@ def install_path_to_cadet_paths(install_path: Optional[os.PathLike]) -> (None, N
95
88
dll_path = cadet_root / 'bin' / 'cadet.dll'
96
89
dll_debug_path = cadet_root / 'bin' / 'cadet_d.dll'
97
90
else :
98
- dll_path = cadet_root / 'lib' / 'lib_cadet .so'
99
- dll_debug_path = cadet_root / 'lib' / 'lib_cadet_d .so'
91
+ dll_path = cadet_root / 'lib' / 'libcadet .so'
92
+ dll_debug_path = cadet_root / 'lib' / 'libcadet_d .so'
100
93
101
94
# Look for debug dll if dll is not found.
102
95
if not dll_path .is_file () and dll_debug_path .is_file ():
@@ -192,7 +185,11 @@ def cadet_path(cls, cadet_path: os.PathLike) -> None:
192
185
"""
193
186
cadet_path = Path (cadet_path )
194
187
195
- warnings .warn ("Deprecation warning: Support for setting cadet.cadet_path will be removed in a future version." )
188
+ warnings .warn (
189
+ "Support for setting cadet.cadet_path will be removed in a future version. "
190
+ "TODO: What alternative should be used?" ,
191
+ DeprecationWarning
192
+ )
196
193
197
194
cls .use_dll = cadet_path .suffix in [".dll" , ".so" ]
198
195
@@ -306,7 +303,7 @@ def install_path(self, install_path: Optional[os.PathLike]) -> None:
306
303
307
304
Parameters
308
305
----------
309
- install_path : Path | os.PathLike | None
306
+ install_path : Optional[ os.PathLike]
310
307
Path to the root of the CADET installation or the executable file 'cadet-cli'.
311
308
If a file path is provided, the root directory will be inferred.
312
309
"""
@@ -324,8 +321,10 @@ def install_path(self, install_path: Optional[os.PathLike]) -> None:
324
321
self .cadet_dll_path = cadet_dll_path
325
322
self .cadet_create_lwe_path = create_lwe_path
326
323
327
- self ._cadet_dll_runner = CadetDLLRunner (self .cadet_dll_path )
328
- self ._cadet_cli_runner = CadetCLIRunner (self .cadet_cli_path )
324
+ if self .cadet_cli_path is not None :
325
+ self ._cadet_cli_runner = CadetCLIRunner (self .cadet_cli_path )
326
+ if self .cadet_dll_path is not None :
327
+ self ._cadet_dll_runner = CadetDLLRunner (self .cadet_dll_path )
329
328
330
329
331
330
@property
0 commit comments