Make copied source read-only files writable (fixes #460)
diff --git a/common/foundry_install.py b/common/foundry_install.py index 3ad0b0d..497a908 100755 --- a/common/foundry_install.py +++ b/common/foundry_install.py
@@ -401,6 +401,7 @@ # File contents have been modified, so if this file was a symbolic # link, then remove it. Otherwise, overwrite the file with the # modified contents. + makeuserwritable(vfile) if os.path.islink(vfile): os.unlink(vfile) with open(vfile, 'w') as ofile:
diff --git a/gf180mcu/custom/scripts/inc_verilog.py b/gf180mcu/custom/scripts/inc_verilog.py index b13eda4..2ea70be 100755 --- a/gf180mcu/custom/scripts/inc_verilog.py +++ b/gf180mcu/custom/scripts/inc_verilog.py
@@ -13,6 +13,12 @@ import re import os import sys +import stat + +def makeuserwritable(filepath): + if os.path.exists(filepath): + st = os.stat(filepath) + os.chmod(filepath, st.st_mode | stat.S_IWUSR) def filter(inname, outname): @@ -73,6 +79,7 @@ else: os.unlink(outname) try: + makeuserwritable(outname) with open(outname, 'w') as outFile: for i in fixedlines: print(i, file=outFile)
diff --git a/sky130/Makefile.in b/sky130/Makefile.in index 8ef1986..b60e3a5 100644 --- a/sky130/Makefile.in +++ b/sky130/Makefile.in
@@ -1264,6 +1264,7 @@ # then remove the larger of the two example directories if test "x${XSCHEM_PATH}" != "x" ; then \ cp -rp ${XSCHEM_PATH}/* ${XSCHEM_STAGING_$*} ; \ + chmod -R u+w ${XSCHEM_STAGING_$*}; \ rm -rf ${XSCHEM_STAGING_$*}/decred_hash_macro ; \ fi # xschem setup is for sky130A. Fix for the given target variant.
diff --git a/sky130/custom/scripts/fix_io_lef.py b/sky130/custom/scripts/fix_io_lef.py index 4255784..d15b0f2 100755 --- a/sky130/custom/scripts/fix_io_lef.py +++ b/sky130/custom/scripts/fix_io_lef.py
@@ -9,6 +9,13 @@ import re import os import sys +import stat + +def makeuserwritable(filepath): + if os.path.exists(filepath): + st = os.stat(filepath) + os.chmod(filepath, st.st_mode | stat.S_IWUSR) + def filter(inname, outname): @@ -83,6 +90,7 @@ else: os.unlink(outname) try: + makeuserwritable(outname) with open(outname, 'w') as outFile: for i in fixedlines: print(i, file=outFile)
diff --git a/sky130/custom/scripts/inc_verilog.py b/sky130/custom/scripts/inc_verilog.py index 9090ca1..df3e4af 100755 --- a/sky130/custom/scripts/inc_verilog.py +++ b/sky130/custom/scripts/inc_verilog.py
@@ -13,6 +13,12 @@ import re import os import sys +import stat + +def makeuserwritable(filepath): + if os.path.exists(filepath): + st = os.stat(filepath) + os.chmod(filepath, st.st_mode | stat.S_IWUSR) def filter(inname, outname): @@ -103,6 +109,7 @@ else: os.unlink(outname) try: + makeuserwritable(outname) with open(outname, 'w') as outFile: for i in fixedlines: print(i, file=outFile)
diff --git a/sky130/custom/scripts/rename_cells.py b/sky130/custom/scripts/rename_cells.py index 2d4dc73..2576bee 100755 --- a/sky130/custom/scripts/rename_cells.py +++ b/sky130/custom/scripts/rename_cells.py
@@ -14,6 +14,12 @@ import re import os import sys +import stat + +def makeuserwritable(filepath): + if os.path.exists(filepath): + st = os.stat(filepath) + os.chmod(filepath, st.st_mode | stat.S_IWUSR) def filter(inname, outname): @@ -54,6 +60,7 @@ else: os.unlink(outname) try: + makeuserwritable(outname) with open(outname, 'w') as outFile: for i in fixedlines: print(i, file=outFile)
diff --git a/sky130/custom/scripts/rename_models.py b/sky130/custom/scripts/rename_models.py index 5b42af8..f95f5ba 100755 --- a/sky130/custom/scripts/rename_models.py +++ b/sky130/custom/scripts/rename_models.py
@@ -12,6 +12,12 @@ import re import os import sys +import stat + +def makeuserwritable(filepath): + if os.path.exists(filepath): + st = os.stat(filepath) + os.chmod(filepath, st.st_mode | stat.S_IWUSR) def filter(inname, outname, ef_format = True): @@ -62,6 +68,7 @@ else: os.unlink(outname) try: + makeuserwritable(outname) with open(outname, 'w') as outFile: for i in fixedlines: print(i, file=outFile)