dabbott     14/04/05 17:45:36

  Modified:             gwn_adds_removes.py
  Log:
  remove profiles from log as this creates an exception and script dies

Revision  Changes    Path
1.13                 src/gwn/gwn_adds_removes.py

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gwn_adds_removes.py?rev=1.13&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gwn_adds_removes.py?rev=1.13&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/gwn/gwn_adds_removes.py?r1=1.12&r2=1.13

Index: gwn_adds_removes.py
===================================================================
RCS file: /var/cvsroot/gentoo/src/gwn/gwn_adds_removes.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- gwn_adds_removes.py 26 Nov 2013 18:52:49 -0000      1.12
+++ gwn_adds_removes.py 5 Apr 2014 17:45:36 -0000       1.13
@@ -7,8 +7,18 @@
 ATTIC_LINK = 
'http://sources.gentoo.org/viewcvs.py/gentoo-x86/%s/%s/?hideattic=0'
 OUTPUT_CHARSET = 'utf-8'
 
-def parse(logfile):
+def remove_profile_line(logfile):
+       outfile = open(logfile, "r")
+       data = []
+       for line in outfile:
+               if not line.lstrip().startswith("profile"):
+                       data.append(line)
+       outfile.close()
+       f = open(logfile, "w")
+       f.writelines(data)
+       f.close
 
+def parse(logfile):
        # Read the log file
        cur = []
        pkgs = {'added': [], 'removed': []}
@@ -82,6 +92,8 @@
                print "[/table]"
 
 if __name__ == '__main__':
+       for i in range(0, len(sys.argv)-1):
+               remove_profile_line(sys.argv[i+1])
        data = []
        if len(sys.argv) < 2:
                print 'Usage: gwn_adds_removes.py -p <log-files>'




Reply via email to