mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge branch 'develop' into enhancement/safe-otio-imports
This commit is contained in:
commit
db8b2171e4
7 changed files with 68 additions and 22 deletions
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -35,6 +35,7 @@ body:
|
||||||
label: Version
|
label: Version
|
||||||
description: What version are you running? Look to AYON Tray
|
description: What version are you running? Look to AYON Tray
|
||||||
options:
|
options:
|
||||||
|
- 1.5.2
|
||||||
- 1.5.1
|
- 1.5.1
|
||||||
- 1.5.0
|
- 1.5.0
|
||||||
- 1.4.1
|
- 1.4.1
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import inspect
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import collections
|
import collections
|
||||||
|
import warnings
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
@ -815,10 +816,26 @@ class AddonsManager:
|
||||||
|
|
||||||
Unknown keys are logged out.
|
Unknown keys are logged out.
|
||||||
|
|
||||||
|
Deprecated:
|
||||||
|
Use targeted methods 'collect_launcher_action_paths',
|
||||||
|
'collect_create_plugin_paths', 'collect_load_plugin_paths',
|
||||||
|
'collect_publish_plugin_paths' and
|
||||||
|
'collect_inventory_action_paths' to collect plugin paths.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict: Output is dictionary with keys "publish", "create", "load",
|
dict: Output is dictionary with keys "publish", "create", "load",
|
||||||
"actions" and "inventory" each containing list of paths.
|
"actions" and "inventory" each containing list of paths.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
warnings.warn(
|
||||||
|
"Used deprecated method 'collect_plugin_paths'. Please use"
|
||||||
|
" targeted methods 'collect_launcher_action_paths',"
|
||||||
|
" 'collect_create_plugin_paths', 'collect_load_plugin_paths'"
|
||||||
|
" 'collect_publish_plugin_paths' and"
|
||||||
|
" 'collect_inventory_action_paths'",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2
|
||||||
|
)
|
||||||
# Output structure
|
# Output structure
|
||||||
output = {
|
output = {
|
||||||
"publish": [],
|
"publish": [],
|
||||||
|
|
@ -874,24 +891,28 @@ class AddonsManager:
|
||||||
if not isinstance(addon, IPluginPaths):
|
if not isinstance(addon, IPluginPaths):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
paths = None
|
||||||
method = getattr(addon, method_name)
|
method = getattr(addon, method_name)
|
||||||
try:
|
try:
|
||||||
paths = method(*args, **kwargs)
|
paths = method(*args, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
(
|
"Failed to get plugin paths from addon"
|
||||||
"Failed to get plugin paths from addon"
|
f" '{addon.name}' using '{method_name}'.",
|
||||||
" '{}' using '{}'."
|
|
||||||
).format(addon.__class__.__name__, method_name),
|
|
||||||
exc_info=True
|
exc_info=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not paths:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if paths:
|
if isinstance(paths, str):
|
||||||
# Convert to list if value is not list
|
paths = [paths]
|
||||||
if not isinstance(paths, (list, tuple, set)):
|
self.log.warning(
|
||||||
paths = [paths]
|
f"Addon '{addon.name}' returned invalid output type"
|
||||||
output.extend(paths)
|
f" from '{method_name}'."
|
||||||
|
f" Got 'str' expected 'list[str]'."
|
||||||
|
)
|
||||||
|
output.extend(paths)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def collect_launcher_action_paths(self):
|
def collect_launcher_action_paths(self):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"""Addon interfaces for AYON."""
|
"""Addon interfaces for AYON."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import warnings
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from typing import TYPE_CHECKING, Callable, Optional, Type
|
from typing import TYPE_CHECKING, Callable, Optional, Type
|
||||||
|
|
||||||
|
|
@ -39,26 +40,29 @@ class AYONInterface(metaclass=_AYONInterfaceMeta):
|
||||||
|
|
||||||
|
|
||||||
class IPluginPaths(AYONInterface):
|
class IPluginPaths(AYONInterface):
|
||||||
"""Addon has plugin paths to return.
|
"""Addon wants to register plugin paths."""
|
||||||
|
|
||||||
Expected result is dictionary with keys "publish", "create", "load",
|
|
||||||
"actions" or "inventory" and values as list or string.
|
|
||||||
{
|
|
||||||
"publish": ["path/to/publish_plugins"]
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def get_plugin_paths(self) -> dict[str, list[str]]:
|
def get_plugin_paths(self) -> dict[str, list[str]]:
|
||||||
"""Return plugin paths for addon.
|
"""Return plugin paths for addon.
|
||||||
|
|
||||||
|
This method was abstract (required) in the past, so raise the required
|
||||||
|
'core' addon version when 'get_plugin_paths' is removed from
|
||||||
|
addon.
|
||||||
|
|
||||||
|
Deprecated:
|
||||||
|
Please implement specific methods 'get_create_plugin_paths',
|
||||||
|
'get_load_plugin_paths', 'get_inventory_action_paths' and
|
||||||
|
'get_publish_plugin_paths' to return plugin paths.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict[str, list[str]]: Plugin paths for addon.
|
dict[str, list[str]]: Plugin paths for addon.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
return {}
|
||||||
|
|
||||||
def _get_plugin_paths_by_type(
|
def _get_plugin_paths_by_type(
|
||||||
self, plugin_type: str) -> list[str]:
|
self, plugin_type: str
|
||||||
|
) -> list[str]:
|
||||||
"""Get plugin paths by type.
|
"""Get plugin paths by type.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -78,6 +82,24 @@ class IPluginPaths(AYONInterface):
|
||||||
|
|
||||||
if not isinstance(paths, (list, tuple, set)):
|
if not isinstance(paths, (list, tuple, set)):
|
||||||
paths = [paths]
|
paths = [paths]
|
||||||
|
|
||||||
|
new_function_name = "get_launcher_action_paths"
|
||||||
|
if plugin_type == "create":
|
||||||
|
new_function_name = "get_create_plugin_paths"
|
||||||
|
elif plugin_type == "load":
|
||||||
|
new_function_name = "get_load_plugin_paths"
|
||||||
|
elif plugin_type == "publish":
|
||||||
|
new_function_name = "get_publish_plugin_paths"
|
||||||
|
elif plugin_type == "inventory":
|
||||||
|
new_function_name = "get_inventory_action_paths"
|
||||||
|
|
||||||
|
warnings.warn(
|
||||||
|
f"Addon '{self.name}' returns '{plugin_type}' paths using"
|
||||||
|
" 'get_plugin_paths' method. Please implement"
|
||||||
|
f" '{new_function_name}' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2
|
||||||
|
)
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
def get_launcher_action_paths(self) -> list[str]:
|
def get_launcher_action_paths(self) -> list[str]:
|
||||||
|
|
|
||||||
|
|
@ -944,6 +944,8 @@ class IWorkfileHost:
|
||||||
self._emit_workfile_save_event(event_data, after_save=False)
|
self._emit_workfile_save_event(event_data, after_save=False)
|
||||||
|
|
||||||
workdir = os.path.dirname(filepath)
|
workdir = os.path.dirname(filepath)
|
||||||
|
if not os.path.exists(workdir):
|
||||||
|
os.makedirs(workdir, exist_ok=True)
|
||||||
|
|
||||||
# Set 'AYON_WORKDIR' environment variable
|
# Set 'AYON_WORKDIR' environment variable
|
||||||
os.environ["AYON_WORKDIR"] = workdir
|
os.environ["AYON_WORKDIR"] = workdir
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Package declaring AYON addon 'core' version."""
|
"""Package declaring AYON addon 'core' version."""
|
||||||
__version__ = "1.5.1+dev"
|
__version__ = "1.5.2+dev"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
name = "core"
|
name = "core"
|
||||||
title = "Core"
|
title = "Core"
|
||||||
version = "1.5.1+dev"
|
version = "1.5.2+dev"
|
||||||
|
|
||||||
client_dir = "ayon_core"
|
client_dir = "ayon_core"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ayon-core"
|
name = "ayon-core"
|
||||||
version = "1.5.1+dev"
|
version = "1.5.2+dev"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Ynput Team <team@ynput.io>"]
|
authors = ["Ynput Team <team@ynput.io>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue