metaforce/hecl/blender/zip_package.py

19 lines
434 B
Python
Raw Normal View History

2015-08-31 03:36:24 +00:00
import sys, os
import zipfile
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
ziph.write(os.path.join(root, file))
package_path = 'hecl'
target_zip = 'hecl.zip'
zf = zipfile.ZipFile(target_zip, mode='w', compression=zipfile.ZIP_DEFLATED)
print('GENERATING', target_zip)
if os.path.isdir(package_path):
zipdir(package_path, zf)
zf.close()