[postprocessor:zip] delete directory (#85)

pull/133/head
Mike Fährmann 6 years ago
parent 2d1a104739
commit eec081dd3e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -10,6 +10,7 @@
from .common import PostProcessor
import zipfile
import os
class ZipPP(PostProcessor):
@ -32,9 +33,10 @@ class ZipPP(PostProcessor):
algorithm)
algorithm = "store"
path = pathfmt.realdirectory + self.ext
self.path = pathfmt.realdirectory
self.zfile = zipfile.ZipFile(
path, "a", self.COMPRESSION_ALGORITHMS[algorithm], True)
self.path + self.ext, "a",
self.COMPRESSION_ALGORITHMS[algorithm], True)
def run(self, pathfmt):
# 'NameToInfo' is not officially documented, but it's available
@ -47,5 +49,11 @@ class ZipPP(PostProcessor):
def finalize(self):
self.zfile.close()
if self.delete:
try:
os.rmdir(self.path)
except OSError:
pass
__postprocessor__ = ZipPP

Loading…
Cancel
Save