Skip to content

Commit 58f38b4

Browse files
committed
making it work for msys2 in dev
2 parents b4774f7 + 6ca355b commit 58f38b4

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

PySpice/Spice/NgSpice/Shared.py

+18-5
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,22 @@ def setup_platform(cls):
416416
cls.LIBRARY_PATH = _
417417
else:
418418
if ConfigInstall.OS.on_windows:
419-
ngspice_path = Path(__file__).parent.joinpath('Spice64_dll')
420-
cls.NGSPICE_PATH = ngspice_path
421-
# path = ngspice_path.joinpath('dll-vs', 'ngspice-{version}{id}.dll')
422-
path = ngspice_path.joinpath('dll-vs', 'ngspice{}.dll')
419+
# Check for MSYSTEM environment first
420+
msystem = os.environ.get('MSYSTEM')
421+
mingw_prefix = os.environ.get('MINGW_PREFIX')
422+
423+
if msystem and mingw_prefix:
424+
# Use MINGW paths
425+
path = str(Path(mingw_prefix) / 'bin' / 'libngspice-0{}.dll')
426+
if 'SPICE_LIB_DIR' not in os.environ:
427+
os.environ['SPICE_LIB_DIR'] = str(Path(mingw_prefix) / 'share' / 'ngspice' / 'scripts')
428+
else:
429+
# Fall back to original Windows paths
430+
ngspice_path = Path(__file__).parent.joinpath('Spice64_dll')
431+
cls.NGSPICE_PATH = ngspice_path
432+
# path = ngspice_path.joinpath('dll-vs', 'ngspice-{version}{id}.dll')
433+
path = str(ngspice_path.joinpath('dll-vs', 'ngspice{}.dll'))
434+
423435
elif ConfigInstall.OS.on_osx:
424436
path = 'libngspice{}.dylib'
425437
elif ConfigInstall.OS.on_linux:
@@ -619,7 +631,8 @@ def _send_char(message_c, ngspice_id, user_data):
619631
func = self._logger.info
620632
elif content.startswith('Warning:'):
621633
func = self._logger.warning
622-
# elif content.startswith('Warning:'):
634+
elif content.startswith('Using'): # Ignore "Using ... as Direct Linear Solver" messages
635+
func = self._logger.debug
623636
else:
624637
self._error_in_stderr = True
625638
func = self._logger.error

0 commit comments

Comments
 (0)