diff --git a/pisi/archive.py b/pisi/archive.py index c39079cc..23ee493b 100644 --- a/pisi/archive.py +++ b/pisi/archive.py @@ -61,8 +61,14 @@ class ArchiveZip(ArchiveBase): def close(self): self.zip.close() - def add_file(self, zipPath, filePath): - self.zip.write(filePath, filePath, zipfile.ZIP_DEFLATED) + def add_file(self, workDir, file): + realPath = workDir + '/' + file + if os.path.isdir(realPath): + self.zip.writestr(file + '/', '') + for f in os.listdir(realPath): + self.add_file(workDir, file + '/' + f) + else: + self.zip.write(realPath, file, zipfile.ZIP_DEFLATED) def unpack_file_cond(self, pred, targetDir, archiveRoot=''): """ unpack file according to predicate function filename -> bool"""