[Swift-commit] r7879 - SwiftApps/swift-galaxy

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Mon May 19 09:49:12 CDT 2014


Author: ketan
Date: 2014-05-19 09:49:05 -0500 (Mon, 19 May 2014)
New Revision: 7879

Modified:
   SwiftApps/swift-galaxy/setup.py
Log:
setup mods to update tool_conf xml

Modified: SwiftApps/swift-galaxy/setup.py
===================================================================
--- SwiftApps/swift-galaxy/setup.py	2014-05-18 23:08:20 UTC (rev 7878)
+++ SwiftApps/swift-galaxy/setup.py	2014-05-19 14:49:05 UTC (rev 7879)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import re
+import xml.etree.ElementTree as ET
 
 """
 Setup script to install swift-galaxy framework to your Galaxy installation.
@@ -16,11 +16,18 @@
 galaxyloc=sys.argv[1]
 
 #step 1. Create symlink to the swift directory from the tools directory of galaxyloc if not already present
-os.symlink (os.getcwd()+"/swift", galaxyloc+"/tools/swift");
+#os.symlink (os.getcwd()+"/swift", galaxyloc+"/tools/swift");
 
 #step 2. update the tool_conf.xml
 
-lines = open(galaxyloc+"/tool_conf.xml").readlines()
+tree = ET.parse(galaxyloc+"/tool_conf.xml")
+root = tree.getroot()
+
+if 'swift' not in root.attrib:
+    root.append((ET.fromstring('<section name="swift" id="swift">\n <tool file="swift/tryswift.xml" />\n <tool file="swift/genericswift.xml" />\n <tool file="swift/swiftforeach.xml" />\n </section>\n ')))
+
+tree.write (galaxyloc+"/tool_conf.xml")
+
 #i = lines.index("<toolbox>")
 #lines.insert(i, 'Random text to insert')
 
@@ -31,5 +38,5 @@
 #</section>
 
 #step 3. Print message
+print "Swift/Galaxy Installed."
 
-




More information about the Swift-commit mailing list