[Erp5-report] r46049 jm - /erp5/trunk/utils/merge_zlogs

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 30 15:50:23 CET 2013


Author: jm
Date: Wed Jan 30 15:50:22 2013
New Revision: 46049

URL: http://svn.erp5.org?rev=46049&view=rev
Log:
merge_zlogs: accept gz/bz2 files

Modified:
    erp5/trunk/utils/merge_zlogs

Modified: erp5/trunk/utils/merge_zlogs
URL: http://svn.erp5.org/erp5/trunk/utils/merge_zlogs?rev=46049&r1=46048&r2=46049&view=diff
==============================================================================
--- erp5/trunk/utils/merge_zlogs [utf8] (original)
+++ erp5/trunk/utils/merge_zlogs [utf8] Wed Jan 30 15:50:22 2013
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-import os.path, re, sys
+import bz2, gzip, os, re, sys
 
 separator = '------'
 
@@ -8,8 +8,12 @@ class Log(object):
   def __init__(self, path, prefix):
     if path == '-':
       self.file = sys.stdin
+    elif path.endswith('.gz'):
+      self.file = gzip.GzipFile(path)
+    elif path.endswith('.bz2'):
+      self.file = bz2.BZ2File(path)
     else:
-      self.file = file(path)
+      self.file = open(path)
     self.prefix = prefix
   def read(self):
     self.msg = []



More information about the Erp5-report mailing list