forked from ufz/ogs5-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy.py
37 lines (29 loc) · 855 Bytes
/
copy.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
#! usr/bin/python
import sys, os, string, shutil
if len(sys.argv) < 2:
print 'Usage: copy.py [List File]'
sys.exit(1)
listFilename = sys.argv[1]
referenceBenchmarkDir = '../benchmarks_ref'
if not os.path.isfile(listFilename):
print 'List File not found'
sys.exit(1)
if not os.path.exists(referenceBenchmarkDir):
os.makedirs(referenceBenchmarkDir)
listFile = open(listFilename, 'r')
for line in listFile:
if not line.strip():
continue
# Ignore CMake variable stuff
elif (line[0:3] == 'SET'):
continue
elif (line[0] == ')'):
continue
else:
line = line.rstrip() # Removes line endings
actualBenchDir = referenceBenchmarkDir + '/' + os.path.dirname(line)
if not os.path.exists(actualBenchDir):
os.makedirs(actualBenchDir)
shutil.copy2(line, actualBenchDir)
listFile.close()
sys.exit(0)