fix packages path when using dev setup with symlinks

This commit is contained in:
Ziad-I
2024-07-16 11:41:05 +03:00
committed by Dion Moult
parent f7a3b0706b
commit 4e79384c8e
2 changed files with 17 additions and 2 deletions
@@ -1,3 +1,11 @@
import sys
import os
blenderbim_path = os.environ.get("blenderbim_path")
if blenderbim_path:
blenderbim_lib_path = os.path.join(blenderbim_path, "libs", "site", "packages")
sys.path.insert(0, blenderbim_lib_path)
import argparse
from aiohttp import web
import socketio
+9 -2
View File
@@ -66,14 +66,21 @@ class Web(blenderbim.core.tool.Web):
@classmethod
def start_websocket_server(cls, port):
import addon_utils
global ws_process
webui_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "webui")
ws_path = os.path.join(webui_path, "sioserver.py")
addon = [a for a in addon_utils.modules() if a.bl_info["name"] == "BlenderBIM"][0]
blenderbim_path = os.path.dirname(addon.__file__)
env = os.environ.copy()
env["blenderbim_path"] = blenderbim_path
ws_process = subprocess.Popen(
[sys.executable, ws_path, "--p", str(port), "--host", "127.0.0.1"], cwd=webui_path
[sys.executable, ws_path, "--p", str(port), "--host", "127.0.0.1"], cwd=webui_path, env=env
)
cls.open_web_browser(port)
cls.set_is_running(True)