-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone.py
More file actions
executable file
·55 lines (46 loc) · 1.46 KB
/
clone.py
File metadata and controls
executable file
·55 lines (46 loc) · 1.46 KB
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
#!/usr/bin/python
import create_run_directory
import sys
import runsarr
import os
from lxml import etree
scwd = str(os.getcwd()).split("/")
if scwd[len(scwd)-1]!="runs":
print "You are not in a runs directory"
sys.exit()
narg=len(sys.argv)
if narg > 2:
print "Number of arguments greater than 1"
sys.exit()
runs=runsarr.runsarr()
for run in runs:
s_project=run[0]
s_tstamp=run[1]
index=int(run[2])
s_description=run[3]
s_path=run[4]
s_status=run[5]
s_importance=run[6]
if index==int(sys.argv[1]):
print "********** CLONE FROM *****************"
print "PROJECT:",s_project
print "TSTAMP:",s_tstamp
print "INDEX:",index
print "DESCRIPTION:", s_description
print "PATH:", s_path
print "***************************************\n"
tstamp,srundir = create_run_directory.create_run_directory()
if os.path.isfile(s_path+"/input.xml"):
#os.system("cp %s/input.xml %s"%(s_path,srundir))
name=s_path+"/input.xml"
root = etree.parse(name).getroot()
# for child in root:
# if child.tag=="keywords":
# child.text=s_description+"\n*** Run cloned from %s ***\n"%(s_path)
s_input=etree.tostring(root, pretty_print="true")
f=open(srundir+"/input.xml","w")
f.write(s_input)
f.close()
else:
description="NO INPUT.XML FILE"
sys.exit()