From 768b5d81b4f091fad53f35341eac7733d634612c Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Thu, 16 Apr 2020 11:59:58 +0200 Subject: [PATCH] more comments, less debug --- main.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 798f765..1ab3e08 100644 --- a/main.py +++ b/main.py @@ -6,16 +6,18 @@ 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") args = parser.parse_args() -print(args.d) fileregex = re.compile(r"(? {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(): - # create dir print(f"src does not exist: {str(src)}") continue + # create directory dst.parent.mkdir(parents=True, exist_ok=True) - - print(file, files[file]) - shutil.copyfile(src, dst) +