mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
define OPENPYPE_ROOTvariable at the top of start.py
This commit is contained in:
parent
95a82eeaf8
commit
c5669a292d
1 changed files with 13 additions and 3 deletions
16
start.py
16
start.py
|
|
@ -100,10 +100,20 @@ import subprocess
|
|||
import site
|
||||
from pathlib import Path
|
||||
|
||||
# add dependencies folder to sys.pat for frozen code
|
||||
if getattr(sys, 'frozen', False):
|
||||
# OPENPYPE_ROOT is variable pointing to build (or code) directory
|
||||
# WARNING `OPENPYPE_ROOT` must be defined before igniter import
|
||||
# - igniter changes cwd which cause that filepath of this script won't lead
|
||||
# to right directory
|
||||
if not getattr(sys, 'frozen', False):
|
||||
# Code root defined by `start.py` directory
|
||||
OPENPYPE_ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
else:
|
||||
OPENPYPE_ROOT = os.path.dirname(sys.executable)
|
||||
|
||||
# add dependencies folder to sys.pat for frozen code
|
||||
frozen_libs = os.path.normpath(
|
||||
os.path.join(os.path.dirname(sys.executable), "dependencies"))
|
||||
os.path.join(OPENPYPE_ROOT, "dependencies")
|
||||
)
|
||||
sys.path.append(frozen_libs)
|
||||
# add stuff from `<frozen>/dependencies` to PYTHONPATH.
|
||||
pythonpath = os.getenv("PYTHONPATH", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue