[pybot-commits] CVS: pybot/contrib vera2info.py,1.1.1.1,1.2
Brought to you by:
niemeyer
From: Gustavo N. <nie...@us...> - 2003-05-16 17:28:06
|
Update of /cvsroot/pybot/pybot/contrib In directory sc8-pr-cvs1:/tmp/cvs-serv4173/contrib Modified Files: vera2info.py Log Message: * contrib/vera2info.py: Updated to add multiple values in the same key, when the keys are the same. * data/infopacks/vera.info: Updated to vera 1.9. Index: vera2info.py =================================================================== RCS file: /cvsroot/pybot/pybot/contrib/vera2info.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vera2info.py 2 Nov 2001 17:19:01 -0000 1.1.1.1 --- vera2info.py 16 May 2003 17:28:03 -0000 1.2 *************** *** 3,18 **** def main(): ! for filename in sys.argv[1:]: ! file = open(filename) ! nextisvalue = 0 ! for line in file.xreadlines(): ! if line[:6] == "@item ": ! print "K:"+line[6:].rstrip() ! nextisvalue = 1 ! elif nextisvalue: ! print "V:tm:"+line.rstrip() ! nextisvalue = 0 ! file.close() if __name__ == "__main__": ! main() --- 3,37 ---- def main(): ! lastkey = None ! append = 0 ! nextisvalue = 0 ! for filename in sys.argv[1:]: ! file = open(filename) ! nextisvalue = 0 ! for line in file.xreadlines(): ! if line[:6] == "@item ": ! key = line[6:].rstrip().lower() ! if key != lastkey: ! if lastkey and not nextisvalue: ! sys.stdout.write("\n") ! lastkey = key ! sys.stdout.write("K:%s\n" % key) ! append = 0 ! else: ! append = 1 ! nextisvalue = 1 ! elif nextisvalue: ! value = line.rstrip() ! if not append: ! sys.stdout.write("V:tm:%s" % value) ! else: ! sys.stdout.write(", %s" % value) ! nextisvalue = 0 ! file.close() ! if lastkey and not nextisvalue: ! sys.stdout.write("\n") if __name__ == "__main__": ! main() ! ! # vim:ts=4:sw=4:et |