| #-------------------------------------------------------------------- |
| # Workaround for the problem that xyce does not like having "vt" |
| # as a subcircuit parameter name, because it is a xyce reserved |
| # name. Change the parameter name in the one file that uses it. |
| # This script is not robust, and depends on the fact that the |
| # one file that declares "vt" does not have any corner model files, |
| # and the characters "vt" do not appear in any other context. |
| #-------------------------------------------------------------------- |
| print('Usage: xyce_hack.py <path_to_file>') |
| infile_name = sys.argv[1] |
| filepath = os.path.split(infile_name)[0] |
| outfile_name = os.path.join(filepath, 'temp') |
| infile = open(infile_name, 'r') |
| outfile = open(outfile_name, 'w') |
| replaced_something = False |
| newline = re.sub('vt', 'local_vt', line) |
| replaced_something = True |
| print("Something was replaced in '{}'".format(infile_name)) |
| os.rename(outfile_name, infile_name) |
| print("Nothing was replaced in '{}'.".format(infile_name)) |