import argparse import sys import re import os from pathlib import Path import shutil 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() 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(): 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()