bug 439050, follow-up patch to close in MozZipFile, make python 2.3 happy, r=ted, djc
authorAxel Hecht <l10n@mozilla.com>
Mon, 22 Sep 2008 11:37:07 +0200
changeset 19493 5b2f1103ce92f55b4d97a452ccd21b69310d0be3
parent 19492 5fa7d5e88e794e65e4e5b3c4f23276cee41f7974
child 19494 6f18a6d949209b1f8acce425be96492388c16c2c
push idunknown
push userunknown
push dateunknown
reviewersted, djc
bugs439050
milestone1.9.1b1pre
bug 439050, follow-up patch to close in MozZipFile, make python 2.3 happy, r=ted, djc
config/JarMaker.py
config/MozZipFile.py
--- a/config/JarMaker.py
+++ b/config/JarMaker.py
@@ -398,17 +398,21 @@ def main():
   jm.processIncludes(options.I)
   jm.outputFormat = options.f
   if options.e:
     jm.useChromeManifest = True
     jm.useJarfileManifest = False
   noise = logging.INFO
   if options.verbose is not None:
     noise = (options.verbose and logging.DEBUG) or logging.WARN
-  logging.basicConfig(level = noise, format = "%(message)s")
+  if sys.version_info[:2] > (2,3):
+    logging.basicConfig(format = "%(message)s")
+  else:
+    logging.basicConfig()
+  logging.getLogger().setLevel(noise)
   if not args:
     jm.makeJar(infile=sys.stdin,
                sourcedirs=options.s, topsourcedir=options.t,
                localedirs=options.l10n_src,
                jardir=options.j)
     return
   topsrc = options.t
   topsrc = os.path.normpath(os.path.abspath(topsrc))
--- a/config/MozZipFile.py
+++ b/config/MozZipFile.py
@@ -133,16 +133,19 @@ class ZipFile(zipfile.ZipFile):
 
     if self.fp.mode != 'r+b':
       # adjust file mode if we originally just wrote, now we rewrite
       self.fp.close()
       self.fp = open(self.filename, 'r+b')
     all = map(lambda zi: (zi, True), self.filelist) + \
         map(lambda zi: (zi, False), self._remove)
     all.sort(lambda l, r: cmp(l[0].header_offset, r[0].header_offset))
+    # empty _remove for multiple closes
+    self._remove = []
+
     lengths = [all[i+1][0].header_offset - all[i][0].header_offset
                for i in xrange(len(all)-1)]
     lengths.append(self.end - all[-1][0].header_offset)
     to_pos = 0
     for (zi, keep), length in zip(all, lengths):
       if not keep:
         continue
       oldoff = zi.header_offset