added set_pype_global_environments which set environments from general and few hardcoded values

This commit is contained in:
iLLiCiTiT 2021-03-11 10:09:59 +01:00
parent 19c6181968
commit 11a0be709c

View file

@ -119,6 +119,26 @@ bootstrap = BootstrapRepos()
silent_commands = ["run", "igniter", "standalonepublisher"]
def set_pype_global_environments() -> None:
"""Set global pype's environments."""
import acre
from pype.settings import get_environments
all_env = get_environments()
# TODO Global environments will be stored in "general" settings so loading
# will be modified and can be done in igniter.
env = acre.merge(all_env["global"], dict(os.environ))
os.environ.clear()
os.environ.update(env)
# Hardcoded default values
os.environ["PYBLISH_GUI"] = "pyblish_pype"
# Change scale factor only if is not set
if "QT_AUTO_SCREEN_SCALE_FACTOR" not in os.environ:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
def run(arguments: list, env: dict = None) -> int:
"""Use correct executable to run stuff.
@ -591,9 +611,11 @@ def boot():
from pype.lib import terminal as t
from pype.version import __version__
print(">>> loading environments ...")
# Must happen before `set_modules_environments`
# Avalon environments must be set before avalon module is imported
print(" - for Avalon ...")
set_avalon_environments()
print(" - global Pype ...")
set_pype_global_environments()
print(" - for modules ...")
set_modules_environments()