From c836bdee4938371fcbdd008a4dd79123b5ea1ff9 Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Thu, 16 Apr 2020 12:04:46 +0200 Subject: [PATCH] remove broken stdin --- main.py | 123 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/main.py b/main.py index 1ab3e08..d4e2828 100644 --- a/main.py +++ b/main.py @@ -6,79 +6,80 @@ 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"(? {files[file]}") + + exit(0) + + + # copy all files found in netlist earlier for file in files: - print(f"copy {file} -> {files[file]}") - - exit(0) - - -# copy all files found in netlist earlier -for file in files: - src = Path(file) - dst = Path(files[file]) - - if not src.exists(): - print(f"src does not exist: {str(src)}") - continue - - # create directory - dst.parent.mkdir(parents=True, exist_ok=True) - shutil.copyfile(src, dst) - + src = Path(file) + dst = Path(files[file]) + if not src.exists(): + print(f"src does not exist: {str(src)}") + continue + # create directory + dst.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(src, dst) + +if __name__ == "__main__": + main() \ No newline at end of file