-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtvlgen.py
More file actions
61 lines (55 loc) · 1.94 KB
/
tvlgen.py
File metadata and controls
61 lines (55 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import argparse
import logging
from pathlib import Path
from core.tvlgenerator import TVLGenerator
def existing_path(path_str: str):
p = Path(path_str)
if not p.is_absolute():
p = Path(".").joinpath(p)
if p.exists():
if not p.is_dir():
raise argparse.ArgumentError(f"{p} is already present but not a directory.")
else:
p.mkdir(parents=True)
return str(p.resolve())
if __name__ == '__main__':
logging.basicConfig(#filename="tvlgen.log",
format='[%(asctime)s %(levelname)-8s %(name)s::%(decorated_funcName)s (%(decorated_filename)s)]: %(message)s',
datefmt='%d.%m.%Y %I:%M:%S %p',
level=logging.INFO)
parser = argparse.ArgumentParser(description="TVL Generator")
parser.add_argument(
'-o', '--outpath',
default="./generated/",
type=existing_path,
help='Relative or absolut path where TVL should be generated into.',
dest='outpath')
parser.add_argument(
'-c', '--configpath',
default="./config/",
type=existing_path,
help='Relative or absolut path to generator config files.',
dest='configpath')
parser.add_argument(
'-d', '--datapath',
default="./primitive_data/",
type=existing_path,
help='Relative or absolut path where TVL primitive and extension files are located.',
dest='datapath')
parser.add_argument(
'-t', '--targets',
default=None,
nargs='*',
dest='targets'
)
args = parser.parse_args()
generator = TVLGenerator(
Path(args.outpath),
Path(args.configpath).joinpath("data/templates"),
Path(args.configpath).joinpath("data/tvl_generator_schema.yaml"),
Path(args.datapath),
Path("static_files")
)
generator.import_data()
generator.create_generated_files(args.targets)
generator.create_static_files()