Skip to content

Commit

Permalink
Merge pull request #4 from ynput/enhancement/use-AYON-prefix-in-env-v…
Browse files Browse the repository at this point in the history
…ariables

Use AYON prefix in env variables
  • Loading branch information
iLLiCiTiT authored Feb 8, 2024
2 parents 2746bc9 + 3bb8b97 commit 7532d35
Show file tree
Hide file tree
Showing 65 changed files with 135 additions and 163 deletions.
2 changes: 1 addition & 1 deletion client/ayon_core/cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def publish(paths, targets=None, gui=False):
else:
pyblish.api.register_target("farm")

os.environ["OPENPYPE_PUBLISH_DATA"] = os.pathsep.join(paths)
os.environ["AYON_PUBLISH_DATA"] = os.pathsep.join(paths)
os.environ["HEADLESS_PUBLISH"] = 'true' # to use in app lib

log.info("Running publish ...")
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/aftereffects/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(self, module_settings):
def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation."""
defaults = {
"OPENPYPE_LOG_NO_COLORS": "True",
"AYON_LOG_NO_COLORS": "1",
"WEBSOCKET_URL": "ws://localhost:8097/ws/"
}
for key, value in defaults.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function startUp(url){
var res = await promis;
log.warn("res: " + res);

promis = runEvalScript("getEnv('OPENPYPE_DEBUG')");
promis = runEvalScript("getEnv('AYON_DEBUG')");
var debug = await promis;
log.warn("debug: " + debug);
if (debug && debug.toString() == '3'){
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/aftereffects/api/launch_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main(*subprocess_args):
host = AfterEffectsHost()
install_host(host)

os.environ["OPENPYPE_LOG_NO_COLORS"] = "False"
os.environ["AYON_LOG_NO_COLORS"] = "0"
app = get_ayon_qt_app()
app.setQuitOnLastWindowClosed(False)

Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/flame/api/scripts/wiretap_com.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, host_name=None, volume_name=None, group_name=None):
self.group_name = group_name or "staff"

# wiretap tools dir path
self.wiretap_tools_dir = os.getenv("OPENPYPE_WIRETAP_TOOLS")
self.wiretap_tools_dir = os.getenv("AYON_WIRETAP_TOOLS")

# initialize WireTap client
WireTapClientInit()
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/flame/hooks/pre_flame_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def __init__(self, *args, **kwargs):

def execute(self):
_env = self.launch_context.env
self.flame_python_exe = _env["OPENPYPE_FLAME_PYTHON_EXEC"]
self.flame_pythonpath = _env["OPENPYPE_FLAME_PYTHONPATH"]
self.flame_python_exe = _env["AYON_FLAME_PYTHON_EXEC"]
self.flame_pythonpath = _env["AYON_FLAME_PYTHONPATH"]

"""Hook entry method."""
project_doc = self.data["project_doc"]
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/fusion/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_launch_hook_paths(self, app):
def add_implementation_envs(self, env, app):
# Set default values if are not already set via settings

defaults = {"OPENPYPE_LOG_NO_COLORS": "Yes"}
defaults = {"AYON_LOG_NO_COLORS": "1"}
for key, value in defaults.items():
if not env.get(key):
env[key] = value
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/fusion/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def run(self):
# getattr of UIManager.GetEvent tries to resolve the Remote Function
# through the PyRemoteObject
get_event = app.UIManager.GetEvent
delay = int(os.environ.get("OPENPYPE_FUSION_CALLBACK_INTERVAL", 1000))
delay = int(os.environ.get("AYON_FUSION_CALLBACK_INTERVAL", 1000))
while True:
if self.isInterruptionRequested():
return
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/fusion/api/pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def run(self):
app = getattr(sys.modules["__main__"], "app", None)

# Interval in milliseconds
interval = os.environ.get("OPENPYPE_FUSION_PULSE_INTERVAL", 1000)
interval = os.environ.get("AYON_FUSION_PULSE_INTERVAL", 1000)

while True:
if self.isInterruptionRequested():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Locked = true,
Global = {
Paths = {
Map = {
["AYON:"] = "$(OPENPYPE_FUSION)/deploy/ayon",
["AYON:"] = "$(AYON_FUSION_ROOT)/deploy/ayon",
["Config:"] = "UserPaths:Config;AYON:Config",
["Scripts:"] = "UserPaths:Scripts;Reactor:System/Scripts",
},
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/fusion/hooks/pre_fusion_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ def execute(self):
# for hook installing PySide2
self.data["fusion_python3_home"] = py3_dir

self.log.info(f"Setting OPENPYPE_FUSION: {FUSION_HOST_DIR}")
self.launch_context.env["OPENPYPE_FUSION"] = FUSION_HOST_DIR
self.log.info(f"Setting AYON_FUSION_ROOT: {FUSION_HOST_DIR}")
self.launch_context.env["AYON_FUSION_ROOT"] = FUSION_HOST_DIR
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/harmony/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class _ZipFile(zipfile.ZipFile):

def main(*subprocess_args):
# coloring in StdOutBroker
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False"
os.environ["AYON_LOG_NO_COLORS"] = "0"
app = QtWidgets.QApplication([])
app.setQuitOnLastWindowClosed(False)
icon = QtGui.QIcon(style.get_app_icon_path())
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/harmony/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def check_inventory():

def application_launch(event):
"""Event that is executed after Harmony is launched."""
# fills OPENPYPE_HARMONY_JS
# fills AYON_HARMONY_JS
pype_harmony_path = Path(__file__).parent.parent / "js" / "PypeHarmony.js"
pype_harmony_js = pype_harmony_path.read_text()

Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/js/creators/CreateRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}

if (typeof $ === 'undefined'){
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/js/loaders/TemplateLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}

if (typeof $ === 'undefined'){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}


Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/js/publish/CollectPalettes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}


Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/js/publish/ExtractPalette.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/js/publish/ExtractTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

// check if PypeHarmony is defined and if not, load it.
if (typeof PypeHarmony === 'undefined') {
var OPENPYPE_HARMONY_JS = System.getenv('OPENPYPE_HARMONY_JS') + '/PypeHarmony.js';
include(OPENPYPE_HARMONY_JS.replace(/\\/g, "/"));
var AYON_HARMONY_JS = System.getenv('AYON_HARMONY_JS') + '/PypeHarmony.js';
include(AYON_HARMONY_JS.replace(/\\/g, "/"));
}


Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/hiero/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from qtpy import QtGui

from ayon_core.lib import Logger
from ayon_core.lib import Logger, is_dev_mode_enabled
from ayon_core.tools.utils import host_tools
from ayon_core.settings import get_project_settings
from ayon_core.pipeline import (
Expand Down Expand Up @@ -125,7 +125,7 @@ def menu_install():
lambda: host_tools.show_library_loader(parent=main_window)
)

if os.getenv("OPENPYPE_DEVELOP"):
if is_dev_mode_enabled():
menu.addSeparator()
reload_action = menu.addAction("Reload pipeline")
reload_action.setIcon(QtGui.QIcon("icons:ColorAdd.png"))
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/maya/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def add_implementation_envs(self, env, _app):

# Set default environments
envs = {
"OPENPYPE_LOG_NO_COLORS": "Yes",
"AYON_LOG_NO_COLORS": "1",
# For python module 'qtpy'
"QT_API": "PySide2",
# For python module 'Qt'
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/maya/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,8 @@ def remove(self, container):
def prepare_root_value(self, file_url, project_name):
"""Replace root value with env var placeholder.
Use ${OPENPYPE_ROOT_WORK} (or any other root) instead of proper root
value when storing referenced url into a workfile.
Use ${AYON_PROJECT_ROOT_WORK} (or any other root) instead of proper
root value when storing referenced url into a workfile.
Useful for remote workflows with SiteSync.
Args:
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/maya/hooks/pre_auto_load_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def execute(self):

# Force post initialization so our dedicated plug-in load can run
# prior to Maya opening a scene file.
key = "OPENPYPE_OPEN_WORKFILE_POST_INITIALIZATION"
key = "AYON_OPEN_WORKFILE_POST_INITIALIZATION"
self.launch_context.env[key] = "1"

self.log.debug("Explicit plugins loading.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def execute(self):
self.data.pop("start_last_workfile")

self.log.debug("Opening workfile post initialization.")
key = "OPENPYPE_OPEN_WORKFILE_POST_INITIALIZATION"
key = "AYON_OPEN_WORKFILE_POST_INITIALIZATION"
self.launch_context.env[key] = "1"
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/maya/startup/userSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _explicit_load_plugins():
)

# Open Workfile Post Initialization.
key = "OPENPYPE_OPEN_WORKFILE_POST_INITIALIZATION"
key = "AYON_OPEN_WORKFILE_POST_INITIALIZATION"
if bool(int(os.environ.get(key, "0"))):
def _log_and_open():
path = os.environ["AVALON_LAST_WORKFILE"]
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/nuke/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ def _get_included_vars(self, config_template):

# include all project root related env vars
for env_var in os.environ:
if env_var.startswith("OPENPYPE_PROJECT_ROOT_"):
if env_var.startswith("AYON_PROJECT_ROOT_"):
included_vars.append(env_var)

# use regex to find env var in template with format {ENV_VAR}
Expand Down Expand Up @@ -2889,7 +2889,7 @@ def launch_workfiles_app():

# get all imortant settings
open_at_start = env_value_to_bool(
env_key="OPENPYPE_WORKFILE_TOOL_ON_START",
env_key="AYON_WORKFILE_TOOL_ON_START",
default=None)

# return if none is defined
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/photoshop/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(self, module_settings):
def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation."""
defaults = {
"OPENPYPE_LOG_NO_COLORS": "True",
"AYON_LOG_NO_COLORS": "1",
"WEBSOCKET_URL": "ws://localhost:8099/ws/"
}
for key, value in defaults.items():
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/photoshop/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main(*subprocess_args):
sys.excepthook = safe_excepthook

# coloring in StdOutBroker
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False"
os.environ["AYON_LOG_NO_COLORS"] = "0"
app = get_ayon_qt_app()
app.setQuitOnLastWindowClosed(False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class CollectBatchData(pyblish.api.ContextPlugin):
"""Collect batch data from json stored in 'OPENPYPE_PUBLISH_DATA' env dir.
"""Collect batch data from json stored in 'AYON_PUBLISH_DATA' env dir.
The directory must contain 'manifest.json' file where batch data should be
stored.
Expand All @@ -39,13 +39,16 @@ class CollectBatchData(pyblish.api.ContextPlugin):

def process(self, context):
self.log.info("CollectBatchData")
batch_dir = os.environ.get("OPENPYPE_PUBLISH_DATA")
batch_dir = (
os.environ.get("AYON_PUBLISH_DATA")
or os.environ.get("OPENPYPE_PUBLISH_DATA")
)
if is_in_tests():
self.log.debug("Automatic testing, no batch data, skipping")
return

assert batch_dir, (
"Missing `OPENPYPE_PUBLISH_DATA`")
"Missing `AYON_PUBLISH_DATA`")

assert os.path.exists(batch_dir), \
"Folder {} doesn't exist".format(batch_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class CollectColorCodedInstances(pyblish.api.ContextPlugin):

def process(self, context):
self.log.info("CollectColorCodedInstances")
batch_dir = os.environ.get("OPENPYPE_PUBLISH_DATA")
batch_dir = (
os.environ.get("AYON_PUBLISH_DATA")
or os.environ.get("OPENPYPE_PUBLISH_DATA")
)
if (is_in_tests() and
(not batch_dir or not os.path.exists(batch_dir))):
self.log.debug("Automatic testing, no batch data, skipping")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def execute(self):

# Add path to launch environment for the startup script to pick up
self.log.info(
"Setting OPENPYPE_RESOLVE_OPEN_ON_LAUNCH to launch "
"Setting AYON_RESOLVE_OPEN_ON_LAUNCH to launch "
f"last workfile: {last_workfile}"
)
key = "OPENPYPE_RESOLVE_OPEN_ON_LAUNCH"
key = "AYON_RESOLVE_OPEN_ON_LAUNCH"
self.launch_context.env[key] = last_workfile
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/resolve/hooks/pre_resolve_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PreLaunchResolveSetup(PreLaunchHook):
It also defines:
- `RESOLVE_UTILITY_SCRIPTS_DIR`: Destination directory for OpenPype
Fusion scripts to be copied to for Resolve to pick them up.
- `OPENPYPE_LOG_NO_COLORS` to True to ensure OP doesn't try to
- `AYON_LOG_NO_COLORS` to True to ensure OP doesn't try to
use logging with terminal colors as it fails in Resolve.
"""
Expand Down Expand Up @@ -132,7 +132,7 @@ def execute(self):
] = resolve_utility_scripts_dir.as_posix()

# remove terminal coloring tags
self.launch_context.env["OPENPYPE_LOG_NO_COLORS"] = "True"
self.launch_context.env["AYON_LOG_NO_COLORS"] = "1"

# Resolve Setup integration
setup(self.launch_context.env)
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/resolve/hooks/pre_resolve_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def execute(self):
# in the LUA .scriptlib code
op_resolve_root = os.path.dirname(ayon_core.hosts.resolve.__file__)
script_path = os.path.join(op_resolve_root, "startup.py")
key = "OPENPYPE_RESOLVE_STARTUP_SCRIPT"
key = "AYON_RESOLVE_STARTUP_SCRIPT"
self.launch_context.env[key] = script_path

self.log.info(
f"Setting OPENPYPE_RESOLVE_STARTUP_SCRIPT to: {script_path}"
f"Setting AYON_RESOLVE_STARTUP_SCRIPT to: {script_path}"
)
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/resolve/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def open_workfile(path):

def main():
# Open last workfile
workfile_path = os.environ.get("OPENPYPE_RESOLVE_OPEN_ON_LAUNCH")
workfile_path = os.environ.get("AYON_RESOLVE_OPEN_ON_LAUNCH")

if workfile_path and os.path.exists(workfile_path):
log.info(f"Opening last workfile: {workfile_path}")
Expand Down
Loading

0 comments on commit 7532d35

Please sign in to comment.