added function to get current context project settings get_current_project_settings

This commit is contained in:
iLLiCiTiT 2020-12-03 11:23:30 +01:00
parent a562e0c3bc
commit 025cf4e8cc
3 changed files with 20 additions and 0 deletions

View file

@ -1,6 +1,7 @@
from .settings import (
get_system_settings,
get_project_settings,
get_current_project_settings,
get_anatomy_data,
get_environments
)
@ -53,6 +54,7 @@ from .lib import _subprocess as subprocess
__all__ = [
"get_system_settings",
"get_project_settings",
"get_current_project_settings",
"get_anatomy_data",
"get_environments",

View file

@ -1,6 +1,7 @@
from .lib import (
get_system_settings,
get_project_settings,
get_current_project_settings,
get_anatomy_data,
get_environments
)
@ -8,6 +9,7 @@ from .lib import (
__all__ = (
"get_system_settings",
"get_project_settings",
"get_current_project_settings",
"get_anatomy_data",
"get_environments"
)

View file

@ -464,6 +464,22 @@ def get_project_settings(project_name):
return apply_overrides(studio_overrides, project_overrides)
def get_current_project_settings():
"""Project settings for current context project.
Project name should be stored in environment variable `AVALON_PROJECT`.
This function should be used only in host context where environment
variable must be set and should not happen that any part of process will
change the value of the enviornment variable.
"""
project_name = os.environ.get("AVALON_PROJECT")
if not project_name:
raise ValueError(
"Missing context project in environemt variable `AVALON_PROJECT`."
)
return get_project_settings(project_name)
def get_environments():
"""Calculated environment based on defaults and system settings.