blob: 70850c04399dedd894aaf5126f14bd0720145f69 [file] [log] [blame]
#!/usr/bin/env python3
import argparse
import os
from pathlib import Path
import common
from common import \
lib_extract_from_name, \
extract_version_and_lib_from_path, \
copy_file_to_output, \
\
convert_libname, \
convert_cell_fullname, \
convert_pinname
__dir__ = os.path.abspath(os.path.dirname(__file__))
template_dir = os.path.join(__dir__, "template")
def filemain(input_file, temp_dir, final_dir, args):
old_lib, new_lib, version = extract_version_and_lib_from_path(input_file)
tdir = Path(template_dir)
for f in tdir.rglob("*"):
fpath = os.path.join(tdir, f)
relpath = os.path.relpath(fpath, tdir)
copy_file_to_output(fpath, final_dir, new_lib, version, 'common', filename=relpath)
if __name__ == "__main__":
import doctest
fails, _ = doctest.testmod()
if fails != 0:
sys.exit("Some test failed")
parser = argparse.ArgumentParser()
parser.add_argument(
"input",
help="The path to the source directory/file",
type=Path)
parser.add_argument(
"output",
help="The path to the output directory",
type=Path)
parser.add_argument(
"temp",
help="The path to the temp directory",
type=Path)
args = parser.parse_args()
common.main('md5sum', filemain, args)