improved build

This commit is contained in:
Michel Fedde 2024-01-29 22:12:56 +01:00
parent 791639bbe7
commit 20458a8c5e
2 changed files with 20 additions and 3 deletions

View file

@ -1,9 +1,11 @@
import os
import shutil
import zipfile
import versioning
ZIP_FILE_NAME = "blender_bake-id-mask_{version}"
ZIP_FILE_NAME = "blender_bake-id-mask_{version}.zip"
PROJECT_NAME = "Bake ID Mask"
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
@ -20,4 +22,19 @@ if __name__ == "__main__":
versioning.save_version(nextVersion)
filename = os.path.join(TARGET_PATH, ZIP_FILE_NAME.format(version=nextVersion.__str__()))
shutil.make_archive(filename, 'zip', SOURCE_PATH)
with zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED) as zip:
for (root, dirs, files) in os.walk(SOURCE_PATH):
if '__pycache__' in dirs:
dirs.remove('__pycache__')
for file in files:
relativePath = os.path.relpath(
os.path.join(root, file),
SOURCE_PATH
)
zip.write(
os.path.join(root, file),
os.path.join(PROJECT_NAME, relativePath)
)