-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathprost.py
executable file
·49 lines (39 loc) · 1.36 KB
/
prost.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import pathlib
import shutil
import subprocess
import sys
def main():
search_params = []
run_debug = False
for arg in sys.argv[1:]:
if arg == "--debug":
run_debug = True
elif arg == "--release":
run_debug = False
else:
search_params.append(arg)
path = pathlib.Path(__file__).parent.absolute()
if run_debug:
parser_name = "rddl-parser-debug"
search_name = "search-debug"
parser_file = os.path.join(path, "builds/debug/rddl_parser/rddl-parser")
search_file = os.path.join(path, "builds/debug/search/search")
else:
parser_name = "rddl-parser-release"
search_name = "search-release"
parser_file = os.path.join(path, "builds/release/rddl_parser/rddl-parser")
search_file = os.path.join(path, "builds/release/search/search")
shutil.copy2(parser_file, "./" + parser_name)
shutil.copy2(search_file, "./" + search_name)
search_params = ['"{}"'.format(p) if " " in p else p for p in search_params]
call_string = "./{} {}".format(search_name, " ".join(search_params))
print(call_string)
exitcode = subprocess.call(call_string, shell=True)
os.remove("./" + parser_name)
os.remove("./" + search_name)
sys.exit(exitcode)
if __name__ == "__main__":
main()