From 4152641d1f4cb4d99a3819db9088319723bc1725 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Sat, 18 Jan 2025 21:17:43 +0000 Subject: [PATCH] Ensure files in libs/bin are executable When blender extracts wheels it doesn't preserve executable permissions --- src/bonsai/bonsai/tool/blender.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index c55bf08f18..19eda84dec 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -21,6 +21,7 @@ import bpy import bmesh import json import os +import platform from ifcopenshell import entity_instance import ifcopenshell.api import ifcopenshell.util.element @@ -437,6 +438,16 @@ class Blender(bonsai.core.tool.Blender): current_path = os.environ["PATH"] if bin_dir not in current_path: os.environ["PATH"] = current_path + os.pathsep + bin_dir + # files need to be executable + if platform.system() != "Windows": + for filename in os.listdir(bin_dir): + file_path = os.path.join(bin_dir, filename) + if os.path.isfile(file_path): + current_permissions = os.stat(file_path).st_mode + try: + os.chmod(file_path, current_permissions | 0o100) + except PermissionError: + pass @classmethod def get_default_selection_keypmap(cls) -> tuple: