mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
fix packages path when using dev setup with symlinks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user