Setup python builder

This commit is contained in:
2026-07-18 16:45:19 +02:00
parent 82653b4fba
commit 693afc76fd
11 changed files with 108 additions and 48 deletions
+11 -31
View File
@@ -1,27 +1,10 @@
import os
import pathlib
import json
import docker
import sys
from blender.version import BlenderVersion
from blender.docker import BlenderDocker
# TODO Update readme file badge with blender version
# TODO add a check if the image build are stored in the docker register
def get_data_from_json() -> (str, str):
"""From the json file, get blender version (major and minor), and return this information."""
file = pathlib.Path(os.getcwd(), 'build.json')
with open(file, 'r') as f:
data = json.load(f)
f.close()
version_values = data['tags'][0]
major, minor = version_values['b3d_vs_major'], version_values['b3d_vs_minor']
return major, minor
def build_docker(b3d_version: (str, str), latest: bool = False):
"""
Generate docker image, request the blender version (major, minor) with the keyword b3d_version, and can be
@@ -52,14 +35,11 @@ def build_docker(b3d_version: (str, str), latest: bool = False):
if __name__ == "__main__":
version = get_data_from_json()
print(f'Start -> Setup the package with blender version "{version[0]}.{version[1]}"')
for arg in sys.argv:
if '--tag=' in arg:
print(f'Build with the tag "{arg}".')
build_docker(b3d_version=version, latest=True)
break
else:
build_docker(b3d_version=version)
print(f'Start to build the docker file.')
pass
version = BlenderVersion(input("Give the blender version (X.Y.Z): "))
# build_docker(b3d_version=(f'{version.major}', f'{version.minor}.{version.hotfix}'),
# latest=False)
print(f"Build a blender version {version}.")
docker = BlenderDocker(version)
docker.build()