mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
added EnvironmentPrepData to store temp data during environments preparation
This commit is contained in:
parent
8c4b5b3158
commit
8337a0b9fd
1 changed files with 31 additions and 0 deletions
|
|
@ -777,6 +777,37 @@ class ApplicationLaunchContext:
|
|||
return args
|
||||
|
||||
|
||||
class MissingRequiredKey(KeyError):
|
||||
pass
|
||||
|
||||
|
||||
class EnvironmentPrepData(dict):
|
||||
"""Helper dictionary for storin temp data during environment prep.
|
||||
|
||||
Args:
|
||||
data (dict): Data must contain required keys.
|
||||
"""
|
||||
required_keys = (
|
||||
"project_doc", "asset_doc", "task_name", "app", "anatomy"
|
||||
)
|
||||
|
||||
def __init__(self, data):
|
||||
for key in self.required_keys:
|
||||
if key not in data:
|
||||
raise MissingRequiredKey(key)
|
||||
|
||||
if not data.get("log"):
|
||||
data["log"] = get_logger()
|
||||
|
||||
if data.get("env") is None:
|
||||
data["env"] = os.environ.copy()
|
||||
|
||||
if data.get("settings_env") is None:
|
||||
data["settings_env"] = get_environments()
|
||||
|
||||
super(EnvironmentPrepData, self).__init__(data)
|
||||
|
||||
|
||||
|
||||
|
||||
def _merge_env(env, current_env):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue