Skip to content

Commit b29b0da

Browse files
committed
Smaller diff with original
1 parent fe08718 commit b29b0da

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

PySpice/Spice/NgSpice/Shared.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,21 @@ 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'))
423434

424435
elif ConfigInstall.OS.on_osx:
425436
path = 'libngspice{}.dylib'
@@ -432,6 +443,8 @@ def setup_platform(cls):
432443

433444
cls.LIBRARY_PATH = str(path)
434445

446+
447+
435448
##############################################
436449

437450
_instances = {}
@@ -508,6 +521,7 @@ def _load_library(self, verbose):
508521
# https://sourceforge.net/p/ngspice/discussion/133842/thread/1cece652/#4e32/5ab8/9027
509522
# When environment variable SPICE_LIB_DIR is empty, ngspice looks in C:\Spice64\share\ngspice\scripts
510523
# Else it tries %SPICE_LIB_DIR%\scripts\spinit
524+
511525
if 'SPICE_LIB_DIR' not in os.environ:
512526
_ = str(Path(self.NGSPICE_PATH).joinpath('share', 'ngspice'))
513527
os.environ['SPICE_LIB_DIR'] = _
@@ -620,7 +634,8 @@ def _send_char(message_c, ngspice_id, user_data):
620634
self._stderr.append(content)
621635
if content.startswith('Warning:'):
622636
func = self._logger.warning
623-
# elif content.startswith('Warning:'):
637+
elif content.startswith('Using'): # Ignore "Using ... as Direct Linear Solver" messages
638+
func = self._logger.debug
624639
else:
625640
self._error_in_stderr = True
626641
func = self._logger.error

0 commit comments

Comments
 (0)