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