File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 8282####################################################################################################
8383
8484from pathlib import Path
85+ import ctypes .util
8586import logging
8687import os
8788import platform
@@ -429,6 +430,16 @@ def setup_platform(cls):
429430
430431 ##############################################
431432
433+ @classmethod
434+ def find_library (cls , name : str ) -> str :
435+ # name must not be prefixed by lib !
436+ if name .startswith ('lib' ):
437+ name = name [3 :]
438+ cls ._logger .debug (f'Search library "{ name } "' )
439+ return ctypes .util .find_library (name )
440+
441+ ##############################################
442+
432443 _instances = {}
433444
434445 @classmethod
@@ -484,17 +495,16 @@ def spinit_not_found(self):
484495 def library_path (self ):
485496 if self ._library_path is None :
486497 if not self ._ngspice_id :
487- library_prefix = ''
498+ _ = ''
488499 else :
489- library_prefix = '{}' . format ( self ._ngspice_id ) # id =
490- library_path = self .LIBRARY_PATH .format (library_prefix )
500+ _ = f' { self ._ngspice_id } ' # id =
501+ library_path = self .find_library ( self . LIBRARY_PATH .format (_ ) )
491502 self ._library_path = library_path
492503 return self ._library_path
493504
494505 ##############################################
495506
496507 def _load_library (self , verbose ):
497-
498508 if ConfigInstall .OS .on_windows :
499509 # https://sourceforge.net/p/ngspice/discussion/133842/thread/1cece652/#4e32/5ab8/9027
500510 # When environment variable SPICE_LIB_DIR is empty, ngspice looks in C:\Spice64\share\ngspice\scripts
You can’t perform that action at this time.
0 commit comments