metaforce/hecl/blender/zip_package.py

19 lines
436 B
Python
Raw Permalink 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'
2015-09-02 02:31:33 +00:00
target_zip = sys.argv[1]
2015-08-31 03:36:24 +00:00
zf = zipfile.ZipFile(target_zip, mode='w', compression=zipfile.ZIP_DEFLATED)
2017-12-23 05:39:03 +00:00
#print('GENERATING', target_zip)
2015-08-31 03:36:24 +00:00
if os.path.isdir(package_path):
zipdir(package_path, zf)
zf.close()