| 129 |
| 130 |
| 131 |
| 132 |
| 133 |
| 134 |
| 135 |
| 136 |
| 137 |
| 138 |
| 139 |
| 140 |
| 141 |
| 142 |
| 143 |
| 144 |
| 145 | |
def getzipdata(self): |
""" return string representing a zipfile containing the package. """ |
import zipfile |
import py |
try: |
from cStringIO import StringIO |
except ImportError: |
from StringIO import StringIO |
base = py.__pkg__.getpath().dirpath() |
outf = StringIO() |
f = zipfile.ZipFile(outf, 'w', compression=zipfile.ZIP_DEFLATED) |
try: |
-> for x in self._iterfiles(): |
f.write(str(x), x.relto(base)) |
finally: |
f.close() |
return outf.getvalue() | |