def generate_zip(): # Write the mini library to a buffer. buf = six.BytesIO() destfile = zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) for filename in filelist: destfile.writestr("paver/%s.py" % filename, pkgutil.get_data('paver', "%s.py" % filename)) destfile.close() # Write the buffer to disk. f = open(output_file, "wb") f.write(buf.getvalue()) f.close()
def generate_zip(): # Write the mini library to a buffer. buf = six.BytesIO() destfile = zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) for filename in filelist: destfile.writestr("paver/%s.py" % filename, pkgutil.get_data('paver', "%s.py" % filename)) # allow minilib to be invoked directly by Python destfile.writestr("__main__.py", "import paver.tasks; paver.tasks.main()\n") destfile.close() # Write the buffer to disk. f = open(output_file, "wb") f.write(buf.getvalue()) f.close()