From e5285bf94c5a8434527e2cd735c3632dc4f028f1 Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Thu, 16 Apr 2020 11:50:53 +0200 Subject: [PATCH] working version --- main.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..798f765 --- /dev/null +++ b/main.py @@ -0,0 +1,76 @@ +import argparse +import sys +import re +import os + +from pathlib import Path +import shutil + +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) + +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 + + dst.parent.mkdir(parents=True, exist_ok=True) + + print(file, files[file]) + + shutil.copyfile(src, dst) + + +