view WebServiceToolWorkflow/DeleteTool2.py~ @ 0:d5cd409b8a18 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author ganjoo
date Tue, 07 Jun 2011 18:00:50 -0400
parents
children
line wrap: on
line source

import os,sys
import string

clientNo = string.atoi(sys.argv[1])

#outputfile=open(sys.argv[1],'w')
#outputfile.seek(0,0)

galaxyhome=os.environ.get('GALAXY_HOME')
f1=open(galaxyhome+'/tool_conf.xml','r')
f1.seek(0,0)
f2=open(galaxyhome+'/tool_conf_backup1.xml','w')
f2.seek(0,0)

line = f1.readline()
f2.write(line)

lineStripped=line.lstrip()
while not lineStripped == '<section name="Web Service Tools" id="WebServices">\n':
    line = f1.readline()
    lineStripped = line.lstrip()
    f2.write(line)
else:
    print line


i=1
while not i==clientNo:
    line = f1.readline()
    lineStripped = line.lstrip()
    f2.write(line)
    i=i+1
else:
    line = f1.readline()

while not lineStripped == '<section name="Web Service Workflow Tools" id="WebServiceWorkflow">\n':
    line = f1.readline()
    lineStripped = line.lstrip()
    f2.write(line)
else:
    print line

i=1
while not i==clientNo:
    line = f1.readline()
    lineStripped = line.lstrip()
    f2.write(line)
    i=i+1
else:
    line = f1.readline()
    
while not lineStripped == '</toolbox>\n':
    line = f1.readline()
    f2.write(line)
    lineStripped = line.lstrip()
else:
    print line

##close f1 and f2
f1.close()
f2.close()

f1=open(galaxyhome+'/tool_conf.xml','w')
f1.seek(0,0)
f2=open(galaxyhome+'/tool_conf_backup1.xml','r')
f2.seek(0,0)

line = f2.readline()
f1.write(line)

lineStripped=line.lstrip()

##write entire f2 into f1 (reverse roles)
while not lineStripped == '</toolbox>\n':
    line = f2.readline()
    f1.write(line)
    lineStripped = line.lstrip()
else:
    print line

f1.close()
f2.close()