| # This script runs as a filter to foundry_install.sh and converts file |
| # names ending with ".sp" to ".spice". If the file has multiple extensions |
| # then all are stripped before adding ".spice". |
| # This script is a filter to be run by setting the name of this script as |
| # the value to "filter=" for the model install in the sky130 Makefile. |
| filepath = os.path.split(inname)[0] |
| filename = os.path.split(inname)[1] |
| filebits = filename.split('.') |
| newname = filebits[0] + '.spice' |
| outname = os.path.join(filepath, newname) |
| if not os.path.isfile(inname): |
| print('No such file ' + inname) |
| print('Renaming file ' + filename + ' to ' + newname) |
| os.rename(inname, outname) |
| if __name__ == '__main__': |
| # This script expects to get one argument, which is the input file. |
| # The script renames the file. |
| for item in sys.argv[1:]: |
| if item.find('-', 0) == 0: |
| infilename = arguments[0] |
| result = filter(infilename) |