From e05c88fccc364984b704acff78e96005f4cb4848 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 23 Jul 2011 20:25:12 +0200 Subject: Add the possibility to do a "ugly" remove on zip archive content --- lib/archive.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/archive.py b/lib/archive.py index 33fe6e7..0c3bb15 100644 --- a/lib/archive.py +++ b/lib/archive.py @@ -76,6 +76,12 @@ class ZipStripper(GenericArchiveStripper): return metadata def remove_all(self): + self._remove_all(self, 'normal') + + def remove_all_ugly(self): + self._remove_all(self, 'ugly') + + def _remove_all(self, method): zipin = zipfile.ZipFile(self.filename, 'r') zipout = zipfile.ZipFile(self.filename + parser.POSTFIX, 'w', allowZip64=True) @@ -85,12 +91,15 @@ class ZipStripper(GenericArchiveStripper): try: cfile = mat.create_class_file(item.filename, False, self.add2archive) - cfile.remove_all() + if method is 'normal': + cfile.remove_all() + else: + cfile.remove_all_ugly() logging.debug('Processing %s from %s' % (item.filename, self.filename)) zipout.write(item.filename) except: - logging.info('%s\' filefomart is not supported' % + logging.info('%s\' fileformat is not supported' % item.filename) if self.add2archive: zipout.write(item.filename) -- cgit v1.3