-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfappAC.py
43 lines (33 loc) · 1.12 KB
/
fappAC.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
#! /usr/bin/env python
import os, glob, sys
import json
import fnmatch
def findFile(pattern,path):
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatch(name, pattern):
return name
def fapp(cmd,configFile, outputFile):
path = '../benchmark/roadef2001/all/'
jsonFile = open(configFile)
data = json.load(jsonFile)
for instance in ["A","B","X"]:
nbIns = len(data[instance])
for i in range(nbIns):
filename = data[instance][i]["name"]
filenamex = filename + "*.in"
fileData = os.path.join(path,findFile(filenamex,path))
fileBegin = "echo f:\t" + filename + "\t" + " >> " + outputFile
os.system(fileBegin)
print(str(filename) + "\t")
cmdIn = cmd + fileData + " 0 " + " >> " + outputFile
os.system(cmdIn)
def delegator():
args = sys.argv
cmd = args[1]
configFile = args[2]
outputFile = args[3]
cmd = "./" + cmd + " "
fapp(cmd,configFile, outputFile)
if __name__ == '__main__':
delegator()