Corrected the set_user_id.py script to (1) reverse the position of

characters in the user_id_textblock layout, which was backwards,
and (2) add a path reference to "hexdigits" for each new character
layout encountered in the file, so that the text block layouts
are found even if "addpath hexdigits" has not been specified.
There were some other corrections to handling gzipped files that
probably does not apply in practice, where "make uncompress" has
been run prior to the set_user_id.py script.
This commit is contained in:
Tim Edwards 2021-12-02 09:35:13 -05:00
parent 5896df50a8
commit 6482c1e011
1 changed files with 16 additions and 4 deletions

View File

@ -306,14 +306,20 @@ if __name__ == '__main__':
# Keep a copy of the original
if not os.path.isfile(gdsbak):
if file_zipped:
os.rename(gdsfilegz, gdsbakgz)
if os.path.isfile(gdsfilegz):
os.rename(gdsfilegz, gdsbakgz)
else:
os.rename(gdsfile, gdsbak)
subprocess.run(['gzip', gdsbak, '-n', '--best'],
stdout = subprocess.DEVNULL,
stderr = subprocess.DEVNULL)
else:
os.rename(gdsfile, gdsbak)
with open(gdsfile, 'wb') as ofile:
ofile.write(gdsdata)
if file_zipped:
subprocess.run(['gzip', gdsdata, '-n', '--best'],
if file_zipped:
subprocess.run(['gzip', gdsfile, '-n', '--best'],
stdout = subprocess.DEVNULL,
stderr = subprocess.DEVNULL)
@ -354,11 +360,17 @@ if __name__ == '__main__':
maglines = ifile.read().splitlines()
outlines = []
digit = 0
wasseen = {}
for line in maglines:
if 'alphaX_' in line:
dchar = user_id_value[digit].upper()
dchar = user_id_value[7 - digit].upper()
oline = re.sub('alpha_[0-9A-F]', 'alpha_' + dchar, line)
# Add path reference if cell was not previously found in the file
if dchar not in wasseen:
if 'hexdigits' not in oline:
oline += ' hexdigits'
outlines.append(oline)
wasseen[dchar] = True
digit += 1
else:
outlines.append(line)