mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
shuffle code to meet import path conundrum
This commit is contained in:
parent
7e98879fd3
commit
89e5e70423
1 changed files with 26 additions and 25 deletions
51
start.py
51
start.py
|
|
@ -99,10 +99,33 @@ import traceback
|
|||
import subprocess
|
||||
import site
|
||||
from pathlib import Path
|
||||
import platform
|
||||
|
||||
import blessed
|
||||
import certifi
|
||||
|
||||
# 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(OPENPYPE_ROOT, "dependencies")
|
||||
)
|
||||
sys.path.append(frozen_libs)
|
||||
sys.path.insert(0, OPENPYPE_ROOT)
|
||||
# add stuff from `<frozen>/dependencies` to PYTHONPATH.
|
||||
pythonpath = os.getenv("PYTHONPATH", "")
|
||||
paths = pythonpath.split(os.pathsep)
|
||||
paths.append(frozen_libs)
|
||||
os.environ["PYTHONPATH"] = os.pathsep.join(paths)
|
||||
|
||||
|
||||
import blessed # noqa: E402
|
||||
import certifi # noqa: E402
|
||||
|
||||
|
||||
term = blessed.Terminal()
|
||||
|
|
@ -135,28 +158,6 @@ else:
|
|||
os.environ["SSL_CERT_FILE"] = ssl_cert_file
|
||||
|
||||
|
||||
# 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(OPENPYPE_ROOT, "dependencies")
|
||||
)
|
||||
sys.path.append(frozen_libs)
|
||||
sys.path.insert(0, OPENPYPE_ROOT)
|
||||
# add stuff from `<frozen>/dependencies` to PYTHONPATH.
|
||||
pythonpath = os.getenv("PYTHONPATH", "")
|
||||
paths = pythonpath.split(os.pathsep)
|
||||
paths.append(frozen_libs)
|
||||
os.environ["PYTHONPATH"] = os.pathsep.join(paths)
|
||||
|
||||
import igniter # noqa: E402
|
||||
from igniter import BootstrapRepos # noqa: E402
|
||||
from igniter.tools import (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue