(self, files, zipName=TEMP_ZIP, *,
comment=None, file_comment=None, stuff=None, prefix='', **kw)
| 111 | fp.write(data) |
| 112 | |
| 113 | def makeZip(self, files, zipName=TEMP_ZIP, *, |
| 114 | comment=None, file_comment=None, stuff=None, prefix='', **kw): |
| 115 | # Create a zip archive based set of modules/packages |
| 116 | # defined by files in the zip file zipName. |
| 117 | # If stuff is not None, it is prepended to the archive. |
| 118 | self.addCleanup(os_helper.unlink, zipName) |
| 119 | |
| 120 | with ZipFile(zipName, "w", compression=self.compression) as z: |
| 121 | self.writeZip(z, files, file_comment=file_comment, prefix=prefix) |
| 122 | if comment is not None: |
| 123 | z.comment = comment |
| 124 | |
| 125 | if stuff is not None: |
| 126 | # Prepend 'stuff' to the start of the zipfile |
| 127 | with open(zipName, "rb") as f: |
| 128 | data = f.read() |
| 129 | with open(zipName, "wb") as f: |
| 130 | f.write(stuff) |
| 131 | f.write(data) |
| 132 | |
| 133 | def writeZip(self, z, files, *, file_comment=None, prefix=''): |
| 134 | for name, data in files.items(): |
no test coverage detected