changed how OPENPYPE_ROOT is set

This commit is contained in:
iLLiCiTiT 2021-04-14 11:42:36 +02:00
parent e2a937133e
commit fa52f68903

View file

@ -543,6 +543,11 @@ def _bootstrap_from_code(use_version):
def boot():
"""Bootstrap OpenPype."""
# ------------------------------------------------------------------------
# Set environment to OpenPype root path
# ------------------------------------------------------------------------
os.environ["OPENPYPE_ROOT"] = OPENPYPE_ROOT
# ------------------------------------------------------------------------
# Play animation
# ------------------------------------------------------------------------
@ -573,16 +578,6 @@ def boot():
os.environ["OPENPYPE_MONGO"] = openpype_mongo
os.environ["OPENPYPE_DATABASE_NAME"] = "openpype" # name of Pype database
# ------------------------------------------------------------------------
# Set environments - load OpenPype path from database (if set)
# ------------------------------------------------------------------------
# set OPENPYPE_ROOT to running location until proper version can be
# determined.
if getattr(sys, 'frozen', False):
os.environ["OPENPYPE_ROOT"] = os.path.dirname(sys.executable)
else:
os.environ["OPENPYPE_ROOT"] = os.path.dirname(__file__)
# Get openpype path from database and set it to environment so openpype can
# find its versions there and bootstrap them.
openpype_path = get_openpype_path_from_db(openpype_mongo)
@ -612,12 +607,6 @@ def boot():
# or to `openpype` or `openpype_console` in case of frozen code
os.environ["OPENPYPE_EXECUTABLE"] = sys.executable
if getattr(sys, 'frozen', False):
os.environ["OPENPYPE_REPOS_ROOT"] = os.environ["OPENPYPE_ROOT"]
else:
os.environ["OPENPYPE_REPOS_ROOT"] = os.path.join(
os.environ["OPENPYPE_ROOT"], "repos")
# delete OpenPype module and it's submodules from cache so it is used from
# specific version
modules_to_del = [