[postprocessor] add 'zip' to write files to a ZIP archive

(#85)
pull/133/head
Mike Fährmann 6 years ago
parent ca4008e1c1
commit d0ae3ed52c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Add files to ZIP archive"""
from .common import PostProcessor
import zipfile
class ZipPP(PostProcessor):
def __init__(self, options):
PostProcessor.__init__(self)
def run(self, pathfmt):
with zipfile.ZipFile(pathfmt.realdirectory + ".zip", "a") as zfile:
zfile.write(pathfmt.realpath, pathfmt.filename)
__postprocessor__ = ZipPP
Loading…
Cancel
Save