SVN: toys/stbr/buildlog_link.py

shadzik shadzik at pld-linux.org
Thu Oct 8 10:57:35 CEST 2009


Author: shadzik
Date: Thu Oct  8 10:57:35 2009
New Revision: 10721

Modified:
   toys/stbr/buildlog_link.py
Log:
- add the option to save the link in a file


Modified: toys/stbr/buildlog_link.py
==============================================================================
--- toys/stbr/buildlog_link.py	(original)
+++ toys/stbr/buildlog_link.py	Thu Oct  8 10:57:35 2009
@@ -4,6 +4,7 @@
 import sys
 import re
 import readline
+import codecs
 
 html = "queue.html"
 
@@ -15,8 +16,9 @@
 		dist = sys.argv[1]
 		id = sys.argv[2]
 	except(IndexError):
-		print "Usage: %s dist buildID [th-arch|ti-arch]" % sys.argv[0]
+		print "Usage: %s dist buildID [th-arch|ti-arch] [file]" % sys.argv[0]
 		return
+
 	f = open(html, 'r')
 	read = f.xreadlines()
 	for l in read:
@@ -41,10 +43,22 @@
 						else:
 							arch = sys.argv[3].split("th-")[1]
 						if re.findall(arch, link):
-							print link
+							try:
+								fs = open(sys.argv[4], "w")
+								fs.write(link)
+								fs.close()
+							except(IndexError):
+								print link
+								pass
 							break
 					except(IndexError):
-						print link
+						try:
+							fs = open(sys.argv[3], "a")
+							fs.write(link)
+							fs.close()
+						except(IndexError):
+							print link
+							pass
 						pass
 	except(UnboundLocalError):
 		return


More information about the pld-cvs-commit mailing list