From a136366804bac698a86e38f3297d6eeeb06152b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 4 Feb 2022 10:57:45 +0100 Subject: [PATCH] Upgrade to BAT 1.10 Upgrade to BAT to fix doubly-compressed blend files. This also changes the way the wheel files are loaded, as the old alphabetical ordering won't pick up on BAT 1.10. It now uses the modification time of the wheel files to find the latest one. --- blender_cloud/wheels/__init__.py | 13 +++++++++++-- requirements.txt | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/blender_cloud/wheels/__init__.py b/blender_cloud/wheels/__init__.py index f5eb570..3a84a25 100644 --- a/blender_cloud/wheels/__init__.py +++ b/blender_cloud/wheels/__init__.py @@ -58,8 +58,12 @@ def wheel_filename(fname_prefix: str) -> str: if not wheels: raise RuntimeError("Unable to find wheel at %r" % path_pattern) - # If there are multiple wheels that match, load the latest one. - wheels.sort() + # If there are multiple wheels that match, load the last-modified one. + # Alphabetical sorting isn't going to cut it since BAT 1.10 was released. + def modtime(filename: str) -> int: + return os.stat(filename).st_mtime + + wheels.sort(key=modtime) return wheels[-1] @@ -68,3 +72,8 @@ def load_wheels(): load_wheel("lockfile", "lockfile") load_wheel("cachecontrol", "CacheControl") load_wheel("pillarsdk", "pillarsdk") + + +if __name__ == "__main__": + wheel = wheel_filename("blender_asset_tracer") + print(f"Wheel: {wheel}") diff --git a/requirements.txt b/requirements.txt index 6b74f49..f9a0639 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ lockfile==0.12.2 pillarsdk==1.8.0 wheel==0.29.0 -blender-asset-tracer==1.8 +blender-asset-tracer==1.10 # Secondary requirements: asn1crypto==0.24.0