commit e5285bf94c5a8434527e2cd735c3632dc4f028f1 Author: Julian Daube Date: Thu Apr 16 11:50:53 2020 +0200 working version 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) + + +