Skip to content

Commit

Permalink
Allowing msys2 to run pyspice
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreijstal committed Nov 23, 2024
1 parent b4774f7 commit 5b99013
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions PySpice/Spice/NgSpice/Shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,22 @@ def setup_platform(cls):
cls.LIBRARY_PATH = _
else:
if ConfigInstall.OS.on_windows:
ngspice_path = Path(__file__).parent.joinpath('Spice64_dll')
cls.NGSPICE_PATH = ngspice_path
# path = ngspice_path.joinpath('dll-vs', 'ngspice-{version}{id}.dll')
path = ngspice_path.joinpath('dll-vs', 'ngspice{}.dll')
# Check for MSYSTEM environment first
msystem = os.environ.get('MSYSTEM')
mingw_prefix = os.environ.get('MINGW_PREFIX')

if msystem and mingw_prefix:
# Use MINGW paths
path = str(Path(mingw_prefix) / 'bin' / 'libngspice-0{}.dll')
if 'SPICE_LIB_DIR' not in os.environ:
os.environ['SPICE_LIB_DIR'] = str(Path(mingw_prefix) / 'share' / 'ngspice' / 'scripts')
else:
# Fall back to original Windows paths
ngspice_path = Path(__file__).parent.joinpath('Spice64_dll')
cls.NGSPICE_PATH = ngspice_path
# path = ngspice_path.joinpath('dll-vs', 'ngspice-{version}{id}.dll')
path = str(ngspice_path.joinpath('dll-vs', 'ngspice{}.dll'))

elif ConfigInstall.OS.on_osx:
path = 'libngspice{}.dylib'
elif ConfigInstall.OS.on_linux:
Expand Down Expand Up @@ -619,7 +631,8 @@ def _send_char(message_c, ngspice_id, user_data):
func = self._logger.info
elif content.startswith('Warning:'):
func = self._logger.warning
# elif content.startswith('Warning:'):
elif content.startswith('Using'): # Ignore "Using ... as Direct Linear Solver" messages
func = self._logger.debug
else:
self._error_in_stderr = True
func = self._logger.error
Expand Down

0 comments on commit 5b99013

Please sign in to comment.