Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues when trying to use pyspice on windows #365

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions PySpice/Scripts/pyspice_post_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import shutil
import sys
import tempfile
import re

import requests

Expand Down Expand Up @@ -252,8 +253,10 @@ def install_ngspice_dll(self):
print(rule)
print(content)
print(rule)
cm_path = spice64_path.joinpath('lib', 'ngspice')
content = content.replace('../lib/ngspice/', str(cm_path) + '/')
content = re.sub(r'^(\s*codemodel\s*).*[\\\/](.*)$',
lambda x: "{} '{}'".format(x.group(1), spice64_path.joinpath('lib', 'ngspice', x.group(2))),
content,
flags=re.MULTILINE)
print(rule)
print(content)
print(rule)
Expand Down
2 changes: 1 addition & 1 deletion PySpice/Spice/Netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ def _str_includes(self, simulator=None):
path = path_flavour
real_paths.append(path)

return join_lines(real_paths, prefix='.include ') + os.linesep
return join_lines([f"'{p}'" for p in real_paths], prefix='.include ') + os.linesep
else:
return ''

Expand Down
4 changes: 2 additions & 2 deletions PySpice/Spice/Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def __init__(self, line):
i = parameter.position
self._dict_parameters[parameter.attribute_name] = self._parameters[i]
to_delete.append(i)
for i in to_delete:
for i in sorted(to_delete, reverse=True):
del self._parameters[i]

# self._logger.debug(os.linesep + self.__repr__())
Expand Down Expand Up @@ -890,7 +890,7 @@ def _parse(self, lines, recurse=False, section=None):
# first line so they'll parse incorrectly if that line is removed.
# For everything else, assume the first line is a TITLE line and
# remove it.
if str(lines[0]).startswith(('.model', '.subckt')):
if str(lines[0]).lower().startswith(('.model', '.subckt')):
start_index = 0
else:
start_index = 1
Expand Down