2024-03-04 21:16:31 +00:00
|
|
|
import os
|
|
|
|
import zipfile
|
|
|
|
|
|
|
|
ignore_list = ['.pytest_cache', '__pycache__']
|
|
|
|
|
|
|
|
def zipdir(path, ziph):
|
|
|
|
# ziph is zipfile handle
|
|
|
|
for root, dirs, files in os.walk(path):
|
|
|
|
# filter out invalid paths
|
|
|
|
root_path = os.path.normpath(root)
|
|
|
|
root_path = root_path.split(os.sep)
|
|
|
|
add_file = True
|
|
|
|
for sub_path in root_path:
|
|
|
|
if sub_path in ignore_list:
|
|
|
|
add_file = False
|
|
|
|
break
|
|
|
|
|
|
|
|
if add_file:
|
|
|
|
for file in files:
|
|
|
|
ziph.write(os.path.join(root, file),
|
|
|
|
os.path.relpath(os.path.join(root, file),
|
|
|
|
os.path.join(path, '..')))
|
|
|
|
|
2024-03-04 21:28:35 +00:00
|
|
|
with zipfile.ZipFile("bevy_components.zip", mode="w", compression=zipfile.ZIP_DEFLATED) as archive:
|
2024-03-04 21:16:31 +00:00
|
|
|
zipdir('./bevy_components', archive)
|
|
|
|
|
2024-03-04 21:28:35 +00:00
|
|
|
with zipfile.ZipFile("gltf_auto_export.zip", mode="w", compression=zipfile.ZIP_DEFLATED) as archive:
|
2024-03-04 21:16:31 +00:00
|
|
|
zipdir('./gltf_auto_export', archive)
|