From 5127555740f31d90a2aedc159a10a4433709a0bc Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 19 Dec 2019 15:31:00 +1100 Subject: [PATCH] Implement Conda Mac and Linux lib loading workaround --- src/ifcblenderexport/blenderbim/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ifcblenderexport/blenderbim/__init__.py b/src/ifcblenderexport/blenderbim/__init__.py index d8db053d7d..052113aad4 100644 --- a/src/ifcblenderexport/blenderbim/__init__.py +++ b/src/ifcblenderexport/blenderbim/__init__.py @@ -11,10 +11,22 @@ bl_info = { "category": "Import-Export" } -# are we running inside Blender? +# Check if we are running in Blender before loading, to allow for multiprocessing import sys +import os bpy = sys.modules.get('bpy') + if bpy is not None: + cwd = os.path.dirname(os.path.realpath(__file__)) + # This workaround is for Mac and Linux Conda builds, which have an rpath set + # to $ORIGIN/../../../ + lib_dir = os.path.join(cwd, '..', 'lib') + if os.path.isdir(lib_dir): + import shutil + files = os.listdir(lib_dir) + for f in files: + shutil.move(lib_dir+f, os.path.join(lib_dir, '..', '..', '..')) + import bpy from . import ui, prop, operator