File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66For better maintenance and evolution of the Python-only code, the module was split in two.
77'''
88
9- import os
9+ import os , sys
1010from . import _altdss_capi_loader
1111from ._altdss_capi_loader import ffi , lib as loader_lib
1212from pathlib import Path
1313
1414altdss_lib_parent_path = Path (_altdss_capi_loader .__file__ ).absolute ().parent
1515
16+ if sys .platform == 'win32' :
17+ DLL_SUFFIX = '.dll'
18+ DLL_PREFIX = ''
19+ elif sys .platform in ('linux' , 'linux2' ):
20+ DLL_SUFFIX = '.so'
21+ DLL_PREFIX = 'lib'
22+ elif sys .platform == 'darwin' :
23+ DLL_SUFFIX = '.dylib'
24+ DLL_PREFIX = 'lib'
25+ else :
26+ raise RuntimeError ("Unsupported platform!" )
27+
1628if os .environ .get ('DSS_EXTENSIONS_DEBUG' , '' ) != '1' :
17- altdss_lib_path = altdss_lib_parent_path .joinpath ('libaltdss_capi.so ' )
29+ altdss_lib_path = altdss_lib_parent_path .joinpath (f' { DLL_PREFIX } altdss_capi { DLL_SUFFIX } ' )
1830else :
1931 import warnings
2032 warnings .warn ('Environment variable DSS_EXTENSIONS_DEBUG=1 is set: loading the debug version of the DSS C-API library' )
21- altdss_lib_path = altdss_lib_parent_path .joinpath ('libaltdss_capid.so ' )
33+ altdss_lib_path = altdss_lib_parent_path .joinpath (f' { DLL_PREFIX } altdss_capid { DLL_SUFFIX } ' )
2234
2335if not altdss_lib_path .exists ():
2436 raise RuntimeError ('AltDSS library not found!' )
You can’t perform that action at this time.
0 commit comments