-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.py
executable file
·74 lines (54 loc) · 2.17 KB
/
configure.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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
import argparse
import os
CONFIG_PY_NAME = 'config.py'
CONFIG_PY_TEXT = """
Z3_PATH = 'z3'
# The following are needed for SYNTCOMP rally_* and related tools.
YOSYS_PATH='/home/ayrat/projects/yosys/yosys'
SDF_PATH='/home/ayrat/projects/sdf/binary/sdf'
AIGTOAIG_PATH='/home/ayrat/projects/aiger-1.9.4/aigtoaig'
SMVTOAIG_PATH='/home/ayrat/projects/aiger-1.9.4/smvtoaig'
COMBINEAIGER_PATH='/home/ayrat/projects/syntcomp/tools/aiger-ltl-model-checker/combine-aiger'
SYFCO_PATH='syfco'
LTL2SMV_PATH='/home/ayrat/projects/NuSMV-2.6.0-Linux/bin/ltl2smv' # used by smvtoaig
# IIMC is only if you plan to model check the results (e.g. using `check_model.py`)
IIMC_PATH='/home/ayrat/projects/iimc-2.0/iimc'
# LTL3BA is _not_ used by default, but if you request --ltl3ba, then provide this:
LTL3BA_PATH = '/home/ayrat/projects/ltl3ba/ltl3ba-1.1.2/ltl3ba'
# these do not seem to be used anymore by default
VL2MV_PATH='/home/ayrat/projects/vl2mv-2.4/vl2mv'
if __name__ == '__main__':
print("open me and modify paths")
"""
def _get_root_dir():
return os.path.dirname(os.path.abspath(__file__))
def _user_confirmed(question):
answer = input(question + ' [y/N] ').strip() or 'n' # note: '' _is_ in 'yY'
assert answer in 'yYnN', answer
return answer in 'yY'
def _check_files_exist(files):
existing = list(filter(lambda f: os.path.exists(f), files))
return existing
def main():
config_py = os.path.join(_get_root_dir(), CONFIG_PY_NAME)
existing = _check_files_exist([CONFIG_PY_NAME])
if not existing or \
_user_confirmed('{files} already exist(s).\n'.format(files=existing) +
'Replace?'):
with open(config_py, 'w') as file:
file.write(CONFIG_PY_TEXT)
print('Created files: {files}\n'
'Now edit them with your paths.'.
format(files=','.join([CONFIG_PY_NAME])))
#
return True
#
return False
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=
'Generate local configuration file')
args = parser.parse_args()
res = main()
print(['not done', 'done'][res])
exit(res)