remove broken stdin
This commit is contained in:
parent
768b5d81b4
commit
c836bdee49
31
main.py
31
main.py
@ -6,19 +6,20 @@ import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
# parse arguments
|
||||
parser = argparse.ArgumentParser(description="parse netlist and pack all references to current working directory")
|
||||
parser.add_argument("files", nargs="*", type=argparse.FileType("r"), default=sys.stdin)
|
||||
parser.add_argument("-d", action="store_const", const=True, default=False, help="Dryrun")
|
||||
def main():
|
||||
# parse arguments
|
||||
parser = argparse.ArgumentParser(description="parse netlist and pack all references to current working directory")
|
||||
parser.add_argument("files", nargs="*", type=argparse.FileType("r"))
|
||||
parser.add_argument("-d", action="store_const", const=True, default=False, help="Dryrun")
|
||||
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_args()
|
||||
|
||||
fileregex = re.compile(r"(?<!\w)file=\"(.*?)\"")
|
||||
files = {}
|
||||
fileregex = re.compile(r"(?<!\w)file=\"(.*?)\"")
|
||||
files = {}
|
||||
|
||||
|
||||
# process all netlists
|
||||
for file in args.files:
|
||||
# process all netlists
|
||||
for file in args.files:
|
||||
location = Path(file.name)
|
||||
print(f"parsing {file.name}")
|
||||
|
||||
@ -58,16 +59,16 @@ for file in args.files:
|
||||
|
||||
outfile.write(content[last:])
|
||||
|
||||
# do dryrun if it is wanted
|
||||
if args.d:
|
||||
# do dryrun if it is wanted
|
||||
if args.d:
|
||||
for file in files:
|
||||
print(f"copy {file} -> {files[file]}")
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
# copy all files found in netlist earlier
|
||||
for file in files:
|
||||
# copy all files found in netlist earlier
|
||||
for file in files:
|
||||
src = Path(file)
|
||||
dst = Path(files[file])
|
||||
|
||||
@ -80,5 +81,5 @@ for file in files:
|
||||
shutil.copyfile(src, dst)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user