Add project-tools #142

Merged
Francesco Siddi merged 26 commits from ZedDB/blender-studio-pipeline:project-helper-tools into main 2023-08-31 20:33:04 +02:00
2 changed files with 4 additions and 12 deletions
Showing only changes of commit beeb2e2fc3 - Show all commits

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
import os
import pathlib

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import filecmp
import glob
import hashlib
import logging
import os
import platform
@ -101,14 +101,6 @@ def extract_zip(file_path: Path, dst_path: Path):
shutil.rmtree(temp_dir)
def compare_checksum(file1, file2):
with open(file1, 'rb') as f1, open(file2, 'rb') as f2:
hash1 = hashlib.sha256(f1.read()).hexdigest()
hash2 = hashlib.sha256(f2.read()).hexdigest()
return hash1 == hash2
def update_addon(addon_zip_name, path_in_zip_to_extract=''):
addon_zip_sha = addon_zip_name + '.sha256'
# This is the file that records all toplevel folders/files installed by this addon
@ -128,7 +120,7 @@ def update_addon(addon_zip_name, path_in_zip_to_extract=''):
local_checksum = PATH_LOCAL / addon_zip_sha
if local_checksum.exists():
if compare_checksum(local_checksum, artifact_checksum):
if filecmp.cmp(local_checksum, artifact_checksum):
logger.info("Already up to date")
return
@ -213,7 +205,7 @@ def update_blender():
local_checksum = PATH_LOCAL / 'blender' / f"{system_name}.sha256"
if local_checksum.exists():
if compare_checksum(local_checksum, blender_build_checksum):
if filecmp.cmp(local_checksum, blender_build_checksum):
logger.info("Already up to date")
return