-
Notifications
You must be signed in to change notification settings - Fork 1
/
wrapper.py
34 lines (28 loc) · 1 KB
/
wrapper.py
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
#!/usr/bin/env python3
"""
MIT License
Copyright (c) 2022 Anubhav Singh
"""
import string
import sys
import subprocess
import os
VALID_EXEC_NAME = [
"Analyse", "DomainView", "HowWhatWhen",
"Instantiate", "Parser", "PinguPlan",
"PlanRec", "PlanSeqStep", "PlanToValStep",
"Relax", "TIM", "ToFn", "TypeAnalysis",
"Validate", "ValStep", "ValueSeq"
]
def val_main(exec_name: str, args: list=[]):
"""A wrapper to execute KCL-VAL binaries
:param exec_name: name of the binary [Exact]
:type exec_name: String
:param args: list of string arguments
:type args: list
"""
if isinstance(exec_name, str) and exec_name in VALID_EXEC_NAME:
EXEC_PATH=os.path.join(os.path.dirname(__file__), "bin/"+exec_name)
return subprocess.call([EXEC_PATH]+args)
else:
raise ValueError("Incorrect program name. Choose from the list: ", VALID_EXEC_NAME)