Permalink
Browse files

Support py 2.4 zip ZipFile, ensure zip files are closed.

  • Loading branch information...
1 parent 84d2076 commit 8b7195cc41dd725b5d05f41271fd60ca2ca116a0 @clach04 committed May 4, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 odplib/zipwrap.py
View
@@ -96,6 +96,7 @@ def load_zipfile(self, path):
else:
content = zin.read(name)
self.touch(name, content)
+ zin.close()
def load_dir(self, path):
@@ -214,7 +215,13 @@ def visit_path(dnf, dirname, names):
for f in dirs_n_files["files"]:
new_path = f[len(self.src_dir):]
+ new_path = os.path.normpath(new_path)
+ if new_path.startswith(os.path.sep):
+ # strip leading path slash
+ # otherwise causes problems under Python 2.4 and zip files
+ new_path = new_path[1:]
zout.write(f, new_path)
+ zout.close()
def _test():

0 comments on commit 8b7195c

Please sign in to comment.