From 2c05f2b23c85cf9bac97897c748eb6b018196633 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 10:36:20 +0000 Subject: [PATCH 01/30] draft: init of settings --- server/settings.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/settings.py b/server/settings.py index fcb6ab5..f800b81 100644 --- a/server/settings.py +++ b/server/settings.py @@ -1,7 +1,22 @@ -from ayon_server.settings import BaseSettingsModel +from ayon_server.settings import BaseSettingsModel, SettingsField DEFAULT_VALUES = {} class MySettings(BaseSettingsModel): pass + + +class InstallAyonExtensionSettingsModel(BaseSettingsModel): + exman_path: str = SettingsField("", title="Path to ExManCmd executable") + enabled: bool = SettingsField(False, title="Enabled") + + +class HooksModel(BaseSettingsModel): + InstallAyonExtensionToPremiere: InstallAyonExtensionSettingsModel = ( + SettingsField( + default_factory=InstallAyonExtensionSettingsModel, + title="Install Extension", + description="Installs the AYON extension using the supplied ExManCmd on startup.", + ) + ) From 634884d85703e89ea861986db0bfc806789039f6 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 10:39:33 +0000 Subject: [PATCH 02/30] chore: update version for testing --- client/ayon_premiere/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_premiere/version.py b/client/ayon_premiere/version.py index a49947d..ed951fd 100644 --- a/client/ayon_premiere/version.py +++ b/client/ayon_premiere/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'premiere' version.""" -__version__ = "0.0.1+dev" +__version__ = "0.0.1+dev.2" From 2e89b348880ce8d25d2bbbf307a27473c5b4e4fd Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 10:41:51 +0000 Subject: [PATCH 03/30] chore: updated package version --- package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.py b/package.py index 2cd2a36..287a811 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "premiere" title = "Premiere" -version = "0.1.0-dev.1" +version = "0.1.0-dev.2" app_host_name = "premiere" client_dir = "ayon_premiere" From 8dee23a205ad00c6409a983e834b0cbf7339a92e Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 10:48:55 +0000 Subject: [PATCH 04/30] fix: default settings missing --- package.py | 2 +- server/__init__.py | 4 ++-- server/settings.py | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package.py b/package.py index 287a811..ce70587 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "premiere" title = "Premiere" -version = "0.1.0-dev.2" +version = "0.1.0-dev.3" app_host_name = "premiere" client_dir = "ayon_premiere" diff --git a/server/__init__.py b/server/__init__.py index ce4b0fb..c0500e1 100644 --- a/server/__init__.py +++ b/server/__init__.py @@ -2,11 +2,11 @@ from ayon_server.addons import BaseServerAddon -from .settings import MySettings, DEFAULT_VALUES +from .settings import PremiereSettings, DEFAULT_VALUES class MyAddon(BaseServerAddon): - settings_model: Type[MySettings] = MySettings + settings_model: Type[PremiereSettings] = PremiereSettings async def get_default_settings(self): settings_model_cls = self.get_settings_model() diff --git a/server/settings.py b/server/settings.py index f800b81..5024f72 100644 --- a/server/settings.py +++ b/server/settings.py @@ -1,10 +1,19 @@ from ayon_server.settings import BaseSettingsModel, SettingsField -DEFAULT_VALUES = {} +DEFAULT_VALUES = { + "hooks": { + "InstallAyonExtensionToPremiere": { + "exman_path": "", + "enabled": False, + } + } +} -class MySettings(BaseSettingsModel): - pass +class PremiereSettings(BaseSettingsModel): + hooks: HooksModel = SettingsField( + default_factory=HooksModel, title="Hooks" + ) class InstallAyonExtensionSettingsModel(BaseSettingsModel): From 58447c050eccd0260ec78abdbf4671c4e133b6ee Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 10:55:08 +0000 Subject: [PATCH 05/30] chore: reordering of defs --- server/settings.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/server/settings.py b/server/settings.py index 5024f72..9660d94 100644 --- a/server/settings.py +++ b/server/settings.py @@ -1,20 +1,5 @@ from ayon_server.settings import BaseSettingsModel, SettingsField -DEFAULT_VALUES = { - "hooks": { - "InstallAyonExtensionToPremiere": { - "exman_path": "", - "enabled": False, - } - } -} - - -class PremiereSettings(BaseSettingsModel): - hooks: HooksModel = SettingsField( - default_factory=HooksModel, title="Hooks" - ) - class InstallAyonExtensionSettingsModel(BaseSettingsModel): exman_path: str = SettingsField("", title="Path to ExManCmd executable") @@ -29,3 +14,19 @@ class HooksModel(BaseSettingsModel): description="Installs the AYON extension using the supplied ExManCmd on startup.", ) ) + + +class PremiereSettings(BaseSettingsModel): + hooks: HooksModel = SettingsField( + default_factory=HooksModel, title="Hooks" + ) + + +DEFAULT_VALUES = { + "hooks": { + "InstallAyonExtensionToPremiere": { + "exman_path": "", + "enabled": False, + } + } +} From 89e0e9bf9aead8973555fd40b7e97ac459932ffd Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 11:04:56 +0000 Subject: [PATCH 06/30] draft: init of prelaunch hook --- .../hooks/pre_exmancmd_install.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 client/ayon_premiere/hooks/pre_exmancmd_install.py diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_exmancmd_install.py new file mode 100644 index 0000000..2cb2530 --- /dev/null +++ b/client/ayon_premiere/hooks/pre_exmancmd_install.py @@ -0,0 +1,30 @@ +from ayon_applications import PreLaunchHook, LaunchTypes + + +class InstallAyonExtensionToPremiere(PreLaunchHook): + app_groups = {"premiere"} + order = 1 + launch_types = {LaunchTypes.local} + + def execute(self): + try: + settings = self.data["project_settings"][self.host_name] + if not settings["hooks"]["InstallAyonExtensionToPremiere"][ + "enabled" + ]: + return + self.inner_execute() + except Exception: + self.log.warning( + "Processing of {} crashed.".format(self.__class__.__name__), + exc_info=True, + ) + + def inner_execute(self): + self.log.debug("Installing AYON extension.") + + self.log.debug( + self.data["project_settings"][self.host_name]["hooks"][ + "InstallAyonExtensionToPremiere" + ]["exman_path"] + ) From ed206feb03526a8c7d12d16a9e714401c154f912 Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 7 Jan 2025 11:25:28 +0000 Subject: [PATCH 07/30] chore: temp commits - moving envs --- client/ayon_premiere/hooks/pre_exmancmd_install.py | 9 ++++----- client/ayon_premiere/version.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_exmancmd_install.py index 2cb2530..1a6edbe 100644 --- a/client/ayon_premiere/hooks/pre_exmancmd_install.py +++ b/client/ayon_premiere/hooks/pre_exmancmd_install.py @@ -3,15 +3,14 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): app_groups = {"premiere"} + order = 1 launch_types = {LaunchTypes.local} def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"][ - "enabled" - ]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: return self.inner_execute() except Exception: @@ -21,9 +20,9 @@ def execute(self): ) def inner_execute(self): - self.log.debug("Installing AYON extension.") + self.log.warning("Installing AYON extension.") - self.log.debug( + self.log.warning( self.data["project_settings"][self.host_name]["hooks"][ "InstallAyonExtensionToPremiere" ]["exman_path"] diff --git a/client/ayon_premiere/version.py b/client/ayon_premiere/version.py index ed951fd..33da90d 100644 --- a/client/ayon_premiere/version.py +++ b/client/ayon_premiere/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'premiere' version.""" -__version__ = "0.0.1+dev.2" +__version__ = "0.1.0-dev.3" From 36b57f397fb86365f03f76984db4191658e834b3 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 11:38:46 +0000 Subject: [PATCH 08/30] draft: installing extension logic --- .../hooks/pre_exmancmd_install.py | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_exmancmd_install.py index 1a6edbe..7447ea8 100644 --- a/client/ayon_premiere/hooks/pre_exmancmd_install.py +++ b/client/ayon_premiere/hooks/pre_exmancmd_install.py @@ -1,3 +1,5 @@ +import subprocess + from ayon_applications import PreLaunchHook, LaunchTypes @@ -10,18 +12,59 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"][ + "enabled" + ]: return - self.inner_execute() + self.inner_execute(settings) except Exception: self.log.warning( "Processing of {} crashed.".format(self.__class__.__name__), exc_info=True, ) - def inner_execute(self): + def inner_execute(self, settings): self.log.warning("Installing AYON extension.") + exman_path = settings["hooks"]["InstallAyonExtensionToPremiere"][ + "exman_path" + ] + if not exman_path: + # no exman path provided + # TODO: add a error message here + return + + exman_path = os.path.normpath(exman_path) + if not os.path.exists(exman_path): + # path invalid + # TODO: add error + return + + local_app_data = os.environ["LOCALAPPDATA"] + + # TODO: dynamic path to relavant addon version + addon_path = os.path.join( + local_app_data, + r"Ynput\AYON\addons\premiere\ayon_premiere\api\extension.zxp", + ) + + command = ["ExManCmd.exe", "/install", addon_path] + + try: + process = subprocess.Popen( + command, + stdout=subprocess.Pipe, + universal_newline=True, + env=dict(os.environ), + ) + process.communicate() + if process.returncode == 0: + self.log.info("Successfully installed AYON extension") + else: + self.log.warning("Failed to install AYON extension") + except Exception: + self.log.warning(Exception) + self.log.warning( self.data["project_settings"][self.host_name]["hooks"][ "InstallAyonExtensionToPremiere" From c6da2be20aa2621d588a77d0ca06d5af6c2d1907 Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 7 Jan 2025 11:59:05 +0000 Subject: [PATCH 09/30] feat: prototype working --- .../hooks/pre_exmancmd_install.py | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_exmancmd_install.py index 7447ea8..bb2ef29 100644 --- a/client/ayon_premiere/hooks/pre_exmancmd_install.py +++ b/client/ayon_premiere/hooks/pre_exmancmd_install.py @@ -1,4 +1,5 @@ import subprocess +import os from ayon_applications import PreLaunchHook, LaunchTypes @@ -12,9 +13,7 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"][ - "enabled" - ]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: return self.inner_execute(settings) except Exception: @@ -24,11 +23,9 @@ def execute(self): ) def inner_execute(self, settings): - self.log.warning("Installing AYON extension.") + self.log.info("Installing AYON extension.") - exman_path = settings["hooks"]["InstallAyonExtensionToPremiere"][ - "exman_path" - ] + exman_path = settings["hooks"]["InstallAyonExtensionToPremiere"]["exman_path"] if not exman_path: # no exman path provided # TODO: add a error message here @@ -45,16 +42,16 @@ def inner_execute(self, settings): # TODO: dynamic path to relavant addon version addon_path = os.path.join( local_app_data, - r"Ynput\AYON\addons\premiere\ayon_premiere\api\extension.zxp", + r"Ynput\AYON\addons\premiere_0.1.0-dev.2\ayon_premiere\api\extension.zxp", ) - command = ["ExManCmd.exe", "/install", addon_path] + command = [exman_path, "/install", addon_path] try: process = subprocess.Popen( command, - stdout=subprocess.Pipe, - universal_newline=True, + stdout=subprocess.PIPE, + universal_newlines=True, env=dict(os.environ), ) process.communicate() @@ -63,10 +60,7 @@ def inner_execute(self, settings): else: self.log.warning("Failed to install AYON extension") except Exception: - self.log.warning(Exception) - - self.log.warning( - self.data["project_settings"][self.host_name]["hooks"][ - "InstallAyonExtensionToPremiere" - ]["exman_path"] - ) + self.log.warning( + "Processing of {} crashed.".format(self.__class__.__name__), + exc_info=True, + ) From 4886cea6fc0e6bbeb157d9cd6a9a7d41a5767cfb Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 7 Jan 2025 12:36:32 +0000 Subject: [PATCH 10/30] feat: dynamic addon path + improved logging --- .../hooks/pre_exmancmd_install.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_exmancmd_install.py index bb2ef29..fbdbe71 100644 --- a/client/ayon_premiere/hooks/pre_exmancmd_install.py +++ b/client/ayon_premiere/hooks/pre_exmancmd_install.py @@ -1,6 +1,7 @@ import subprocess import os +from ayon_premiere import PREMIERE_ADDON_ROOT from ayon_applications import PreLaunchHook, LaunchTypes @@ -23,31 +24,28 @@ def execute(self): ) def inner_execute(self, settings): - self.log.info("Installing AYON extension.") + self.log.info("Installing AYON Premiere extension.") exman_path = settings["hooks"]["InstallAyonExtensionToPremiere"]["exman_path"] if not exman_path: - # no exman path provided - # TODO: add a error message here + self.log.warning("ExManCmd path was not provided. Cancelling installation.") return exman_path = os.path.normpath(exman_path) if not os.path.exists(exman_path): - # path invalid - # TODO: add error + self.log.warning( + f"Provided ExManCmd path: '{exman_path}', does not exist. Cancelling installation." + ) return - local_app_data = os.environ["LOCALAPPDATA"] - - # TODO: dynamic path to relavant addon version - addon_path = os.path.join( - local_app_data, - r"Ynput\AYON\addons\premiere_0.1.0-dev.2\ayon_premiere\api\extension.zxp", - ) + try: + addon_path = os.path.join( + PREMIERE_ADDON_ROOT, + rf"api\extension.zxp", + ) - command = [exman_path, "/install", addon_path] + command = [exman_path, "/install", addon_path] - try: process = subprocess.Popen( command, stdout=subprocess.PIPE, From bc7e8d1bba1cd07f8abf0b00e3455b17b96d7384 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 14:26:59 +0000 Subject: [PATCH 11/30] chore: downgraded version --- client/ayon_premiere/version.py | 2 +- package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_premiere/version.py b/client/ayon_premiere/version.py index 33da90d..4cbb826 100644 --- a/client/ayon_premiere/version.py +++ b/client/ayon_premiere/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'premiere' version.""" -__version__ = "0.1.0-dev.3" +__version__ = "0.1.0+dev.1" diff --git a/package.py b/package.py index ce70587..2cd2a36 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "premiere" title = "Premiere" -version = "0.1.0-dev.3" +version = "0.1.0-dev.1" app_host_name = "premiere" client_dir = "ayon_premiere" From 5251bbacb1f34a9684e0cb0ab84d70040cbefcd1 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 14:29:29 +0000 Subject: [PATCH 12/30] refactor: better naming on hookfile --- ...e_exmancmd_install.py => pre_launch_install_ayon_extension.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename client/ayon_premiere/hooks/{pre_exmancmd_install.py => pre_launch_install_ayon_extension.py} (100%) diff --git a/client/ayon_premiere/hooks/pre_exmancmd_install.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py similarity index 100% rename from client/ayon_premiere/hooks/pre_exmancmd_install.py rename to client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py From ce57576d4d6e3cd06f8ef69265eafe1943ea4052 Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 7 Jan 2025 14:46:18 +0000 Subject: [PATCH 13/30] fix: incorrect version --- client/ayon_premiere/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_premiere/version.py b/client/ayon_premiere/version.py index 4cbb826..a49947d 100644 --- a/client/ayon_premiere/version.py +++ b/client/ayon_premiere/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'premiere' version.""" -__version__ = "0.1.0+dev.1" +__version__ = "0.0.1+dev" From d25e419df8fbd76e419b292dd397097ded29516b Mon Sep 17 00:00:00 2001 From: Jack P Date: Wed, 8 Jan 2025 11:26:59 +0000 Subject: [PATCH 14/30] draft: unzipping .zxp directly to appdata + switching env --- .../pre_launch_install_ayon_extension.py | 42 ++++--------------- server/settings.py | 17 +++----- 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index fbdbe71..bab07fd 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -1,5 +1,6 @@ import subprocess import os +from zipfile import ZipFile from ayon_premiere import PREMIERE_ADDON_ROOT from ayon_applications import PreLaunchHook, LaunchTypes @@ -26,39 +27,14 @@ def execute(self): def inner_execute(self, settings): self.log.info("Installing AYON Premiere extension.") - exman_path = settings["hooks"]["InstallAyonExtensionToPremiere"]["exman_path"] - if not exman_path: - self.log.warning("ExManCmd path was not provided. Cancelling installation.") - return + addon_path = os.path.join( + PREMIERE_ADDON_ROOT, + rf"api\extension.zxp", + ) - exman_path = os.path.normpath(exman_path) - if not os.path.exists(exman_path): - self.log.warning( - f"Provided ExManCmd path: '{exman_path}', does not exist. Cancelling installation." - ) - return - - try: - addon_path = os.path.join( - PREMIERE_ADDON_ROOT, - rf"api\extension.zxp", + with ZipFile(addon_path, "r") as zip: + zip.extractall( + path=r"C:\Users\Jack.P\AppData\Roaming\Adobe\CEP\extensions\io.ynput.PPRO.panel" ) - command = [exman_path, "/install", addon_path] - - process = subprocess.Popen( - command, - stdout=subprocess.PIPE, - universal_newlines=True, - env=dict(os.environ), - ) - process.communicate() - if process.returncode == 0: - self.log.info("Successfully installed AYON extension") - else: - self.log.warning("Failed to install AYON extension") - except Exception: - self.log.warning( - "Processing of {} crashed.".format(self.__class__.__name__), - exc_info=True, - ) + self.log.info("Successfully installed AYON extension") diff --git a/server/settings.py b/server/settings.py index 9660d94..93a6d4d 100644 --- a/server/settings.py +++ b/server/settings.py @@ -1,31 +1,24 @@ from ayon_server.settings import BaseSettingsModel, SettingsField -class InstallAyonExtensionSettingsModel(BaseSettingsModel): - exman_path: str = SettingsField("", title="Path to ExManCmd executable") +class HookOptionalModel(BaseSettingsModel): enabled: bool = SettingsField(False, title="Enabled") class HooksModel(BaseSettingsModel): - InstallAyonExtensionToPremiere: InstallAyonExtensionSettingsModel = ( - SettingsField( - default_factory=InstallAyonExtensionSettingsModel, - title="Install Extension", - description="Installs the AYON extension using the supplied ExManCmd on startup.", - ) + InstallAyonExtensionToPremiere: HookOptionalModel = SettingsField( + default_factory=HookOptionalModel, + title="Install AYON Extension", ) class PremiereSettings(BaseSettingsModel): - hooks: HooksModel = SettingsField( - default_factory=HooksModel, title="Hooks" - ) + hooks: HooksModel = SettingsField(default_factory=HooksModel, title="Hooks") DEFAULT_VALUES = { "hooks": { "InstallAyonExtensionToPremiere": { - "exman_path": "", "enabled": False, } } From 13914f13faed9885a3b5954842cae448c07584f2 Mon Sep 17 00:00:00 2001 From: Sponge Date: Wed, 8 Jan 2025 11:36:07 +0000 Subject: [PATCH 15/30] draft: prototype of unzipping with relevant checks switching envs for testing --- .../pre_launch_install_ayon_extension.py | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index bab07fd..3eb73d1 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -15,7 +15,9 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"][ + "enabled" + ]: return self.inner_execute(settings) except Exception: @@ -29,12 +31,26 @@ def inner_execute(self, settings): addon_path = os.path.join( PREMIERE_ADDON_ROOT, - rf"api\extension.zxp", + r"api\extension.zxp", + ) + target_path = os.path.join( + os.environ["appdata"], r"Adobe\CEP\extensions\io.ynput.PPRO.panel" ) - with ZipFile(addon_path, "r") as zip: - zip.extractall( - path=r"C:\Users\Jack.P\AppData\Roaming\Adobe\CEP\extensions\io.ynput.PPRO.panel" - ) + if os.path.exists(target_path): + self.log.info(f"Extension already exists at: {target_path}") + return + + try: + self.log.debug(f"Creating directory: {target_path}") + os.makedirs(target_path, exist_ok=True) - self.log.info("Successfully installed AYON extension") + with ZipFile(addon_path, "r") as zip: + zip.extractall(path=target_path) + + self.log.info("Successfully installed AYON extension") + + except Exception as error: + self.log.warning( + f"Failed to install AYON extension due to: {error}" + ) From 7d9b6731ba3279f560b727a86a77d904e014463f Mon Sep 17 00:00:00 2001 From: Jack P Date: Wed, 8 Jan 2025 11:53:29 +0000 Subject: [PATCH 16/30] feat: unzipping extension to target path --- .../pre_launch_install_ayon_extension.py | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 3eb73d1..ccb8308 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -1,4 +1,3 @@ -import subprocess import os from zipfile import ZipFile @@ -7,6 +6,13 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): + """ + Automatically 'installs' the AYON Premiere extension. + + Checks if Premiere already has the extension in the relevant folder, + will try to create that folder and unzip the extension if not. + """ + app_groups = {"premiere"} order = 1 @@ -15,42 +21,48 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"][ - "enabled" - ]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: return - self.inner_execute(settings) + self.inner_execute() + except Exception: self.log.warning( "Processing of {} crashed.".format(self.__class__.__name__), exc_info=True, ) - def inner_execute(self, settings): + def inner_execute(self): self.log.info("Installing AYON Premiere extension.") - addon_path = os.path.join( - PREMIERE_ADDON_ROOT, - r"api\extension.zxp", - ) target_path = os.path.join( os.environ["appdata"], r"Adobe\CEP\extensions\io.ynput.PPRO.panel" ) if os.path.exists(target_path): - self.log.info(f"Extension already exists at: {target_path}") + self.log.info( + f"The extension already exists at: {target_path}. Cancelling.." + ) return + extension_path = os.path.join( + PREMIERE_ADDON_ROOT, + r"api\extension.zxp", + ) + try: self.log.debug(f"Creating directory: {target_path}") os.makedirs(target_path, exist_ok=True) - with ZipFile(addon_path, "r") as zip: + with ZipFile(extension_path, "r") as zip: zip.extractall(path=target_path) self.log.info("Successfully installed AYON extension") + except OSError as error: + self.log.warning(f"OS error has occured: {error}") + + except PermissionError as error: + self.log.warning(f"Permissions error has occured: {error}") + except Exception as error: - self.log.warning( - f"Failed to install AYON extension due to: {error}" - ) + self.log.warning(f"An unexpected error occured: {error}") From eaf92cd6c6af5b7ec271caf1ac50ca970bba81ff Mon Sep 17 00:00:00 2001 From: Sponge Date: Wed, 8 Jan 2025 14:06:04 +0000 Subject: [PATCH 17/30] fix: added check to prevent running on non windows platforms --- .../hooks/pre_launch_install_ayon_extension.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index ccb8308..08c5a35 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -1,4 +1,5 @@ import os +import platform from zipfile import ZipFile from ayon_premiere import PREMIERE_ADDON_ROOT @@ -21,7 +22,9 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"][ + "enabled" + ]: return self.inner_execute() @@ -34,6 +37,10 @@ def execute(self): def inner_execute(self): self.log.info("Installing AYON Premiere extension.") + # Windows only for now. + if not platform.system().lower() == "windows": + return + target_path = os.path.join( os.environ["appdata"], r"Adobe\CEP\extensions\io.ynput.PPRO.panel" ) From 096115cc1f054698a18954e98391205c699bdf4e Mon Sep 17 00:00:00 2001 From: Jack P Date: Wed, 8 Jan 2025 14:12:15 +0000 Subject: [PATCH 18/30] chore: added logging for non windows platform --- client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 08c5a35..d884345 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -39,6 +39,7 @@ def inner_execute(self): # Windows only for now. if not platform.system().lower() == "windows": + self.log.info("Non Windows platform. Cancelling..") return target_path = os.path.join( From 450ab0ab4622670ac983cd3e126234939a9f130d Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Jan 2025 13:18:59 +0100 Subject: [PATCH 19/30] Added check for extension version and redeploy --- .../pre_launch_install_ayon_extension.py | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index d884345..d5f6d63 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -1,5 +1,7 @@ import os +import re import platform +import shutil from zipfile import ZipFile from ayon_premiere import PREMIERE_ADDON_ROOT @@ -46,18 +48,18 @@ def inner_execute(self): os.environ["appdata"], r"Adobe\CEP\extensions\io.ynput.PPRO.panel" ) - if os.path.exists(target_path): - self.log.info( - f"The extension already exists at: {target_path}. Cancelling.." - ) - return - extension_path = os.path.join( PREMIERE_ADDON_ROOT, r"api\extension.zxp", ) try: + deploy = self._deploy_extension(extension_path, target_path) + + if not deploy: + self.log.debug(f"Extension already deployed at {target_path}.") + return + self.log.debug(f"Creating directory: {target_path}") os.makedirs(target_path, exist_ok=True) @@ -74,3 +76,30 @@ def inner_execute(self): except Exception as error: self.log.warning(f"An unexpected error occured: {error}") + + + def _deploy_extension(self, extension_path, target_path): + """Check if current extension version is installed, purge old ones.""" + with ZipFile(extension_path, 'r') as zip_file: + with zip_file.open('CSXS/manifest.xml') as manifest_file: + content = manifest_file.read() + pattern = r'ExtensionBundleVersion="([^"]+)"' + extension_version = re.search(pattern, str(content)).group(1) + + deployed_manifest_path = os.path.join( + target_path, "CSXS", "manifest.xml") + if not os.path.exists(deployed_manifest_path): + return True + + with open(deployed_manifest_path, "r") as deployed_manifest_file: + deployed_content = deployed_manifest_file.read() + deployed_extension_version =( + re.search(pattern, str(deployed_content)).group(1) + ) + + if extension_version != deployed_extension_version: + self.log.info(f"Purging {target_path} because different version") + shutil.rmtree(target_path) + return True + + return False From a8542b8003aaaf561ae21caa52ea4523436c4a41 Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 21 Jan 2025 12:40:04 +0000 Subject: [PATCH 20/30] feat: version compare --- .../pre_launch_install_ayon_extension.py | 80 ++++++++++++++++--- 1 file changed, 68 insertions(+), 12 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index d884345..262bcbd 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -22,9 +22,7 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"][ - "enabled" - ]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: return self.inner_execute() @@ -46,24 +44,25 @@ def inner_execute(self): os.environ["appdata"], r"Adobe\CEP\extensions\io.ynput.PPRO.panel" ) - if os.path.exists(target_path): - self.log.info( - f"The extension already exists at: {target_path}. Cancelling.." - ) - return - extension_path = os.path.join( PREMIERE_ADDON_ROOT, r"api\extension.zxp", ) + # Extension already installed, compare the versions to see if we need to replace + if os.path.exists(target_path): + self.log.info( + f"The extension already exists at: {target_path}. Comparing versions.." + ) + if not self._compare_extension_versions(target_path, extension_path): + return + try: self.log.debug(f"Creating directory: {target_path}") os.makedirs(target_path, exist_ok=True) - with ZipFile(extension_path, "r") as zip: - zip.extractall(path=target_path) - + with ZipFile(extension_path, "r") as archive: + archive.extractall(path=target_path) self.log.info("Successfully installed AYON extension") except OSError as error: @@ -74,3 +73,60 @@ def inner_execute(self): except Exception as error: self.log.warning(f"An unexpected error occured: {error}") + + def _compare_extension_versions(self, target_path, extension_path): + try: + import xml.etree.ElementTree as ET + from shutil import rmtree + + # opens the existing extension manifest to get the Version attribute. + with open(f"{target_path}/CSXS/manifest.xml", "rb") as xml_file: + installed_version = ( + ET.parse(xml_file).find("*/Extension").attrib.get("Version") + ) + self.log.debug(f"Current extension version found: {installed_version}") + + if not installed_version: + self.log.warning( + "Unable to resolve the currently installed extension version. Cancelling.." + ) + return False + + # opens the .zxp manifest to get the Version attribute. + with ZipFile(extension_path, "r") as archive: + xml_file = archive.open("CSXS/manifest.xml") + new_version = ( + ET.parse(xml_file).find("*/Extension").attrib.get("Version") + ) + if not new_version: + self.log.warning( + "Unable to resolve the new extension version. Cancelling.." + ) + self.log.debug(f"New extension version found: {new_version}") + + # compare the two versions, a simple == is enough since the we don't care if the + # version increments or decrements, if they match nothing happens. + if installed_version == new_version: + self.log.info("Versions matched. Cancelling..") + return False + + # remove the existing addon to prevent any side effects when unzipping later. + self.log.info("Version mismatch found. Removing old extensions..") + rmtree(target_path) + return True + + except PermissionError as error: + self.log.warning( + f"Permissions error has occured while comparing versions: {error}" + ) + return False + + except OSError as error: + self.log.warning(f"OS error has occured while comparing versions: {error}") + return False + + except Exception as error: + self.log.warning( + f"An unexpected error occured when comparing version: {error}" + ) + return False From 3447228f69d631aa87d589ba24f5185049dbf55a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Jan 2025 14:07:31 +0100 Subject: [PATCH 21/30] Rename method --- .../hooks/pre_launch_install_ayon_extension.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index d5f6d63..10476a9 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -54,7 +54,7 @@ def inner_execute(self): ) try: - deploy = self._deploy_extension(extension_path, target_path) + deploy = self._should_deploy_extension(extension_path, target_path) if not deploy: self.log.debug(f"Extension already deployed at {target_path}.") @@ -78,8 +78,9 @@ def inner_execute(self): self.log.warning(f"An unexpected error occured: {error}") - def _deploy_extension(self, extension_path, target_path): - """Check if current extension version is installed, purge old ones.""" + def _should_deploy_extension( + self, extension_path: str, target_path:str) -> bool: + """Check if current extension version is installed, purge old one.""" with ZipFile(extension_path, 'r') as zip_file: with zip_file.open('CSXS/manifest.xml') as manifest_file: content = manifest_file.read() From f7383d7ddda4134e47e10231e5736b8b13b12d28 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Jan 2025 14:07:53 +0100 Subject: [PATCH 22/30] Remove newline --- client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 10476a9..e737fdc 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -77,7 +77,6 @@ def inner_execute(self): except Exception as error: self.log.warning(f"An unexpected error occured: {error}") - def _should_deploy_extension( self, extension_path: str, target_path:str) -> bool: """Check if current extension version is installed, purge old one.""" From 528b1d3d4b51e0f1c7339ff436efd5efdee2996a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Jan 2025 14:11:10 +0100 Subject: [PATCH 23/30] Updated log --- .../hooks/pre_launch_install_ayon_extension.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index e737fdc..ce96fe8 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -98,7 +98,11 @@ def _should_deploy_extension( ) if extension_version != deployed_extension_version: - self.log.info(f"Purging {target_path} because different version") + self.log.info( + f"Purging '{target_path}' with " + f"'{deployed_extension_version}', " + f"replacing with '{extension_version}'" + ) shutil.rmtree(target_path) return True From 4883c0cdde6c137ac18f295141eb32757bcdea86 Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 21 Jan 2025 13:21:41 +0000 Subject: [PATCH 24/30] refactor: type hints --- .../ayon_premiere/hooks/pre_launch_install_ayon_extension.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 262bcbd..489207f 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -74,7 +74,9 @@ def inner_execute(self): except Exception as error: self.log.warning(f"An unexpected error occured: {error}") - def _compare_extension_versions(self, target_path, extension_path): + def _compare_extension_versions( + self, target_path: str, extension_path: str + ) -> bool: try: import xml.etree.ElementTree as ET from shutil import rmtree From d067c6d91f4c9b9212e8b73914be708c6ee4a5cd Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 21 Jan 2025 13:33:18 +0000 Subject: [PATCH 25/30] refactor: black-79lines used + move imports to top of file --- .../pre_launch_install_ayon_extension.py | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 489207f..2ec3f6e 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -1,6 +1,9 @@ import os import platform from zipfile import ZipFile +import xml.etree.ElementTree as ET +from shutil import rmtree + from ayon_premiere import PREMIERE_ADDON_ROOT from ayon_applications import PreLaunchHook, LaunchTypes @@ -22,7 +25,9 @@ class InstallAyonExtensionToPremiere(PreLaunchHook): def execute(self): try: settings = self.data["project_settings"][self.host_name] - if not settings["hooks"]["InstallAyonExtensionToPremiere"]["enabled"]: + if not settings["hooks"]["InstallAyonExtensionToPremiere"][ + "enabled" + ]: return self.inner_execute() @@ -54,7 +59,9 @@ def inner_execute(self): self.log.info( f"The extension already exists at: {target_path}. Comparing versions.." ) - if not self._compare_extension_versions(target_path, extension_path): + if not self._compare_extension_versions( + target_path, extension_path + ): return try: @@ -78,15 +85,16 @@ def _compare_extension_versions( self, target_path: str, extension_path: str ) -> bool: try: - import xml.etree.ElementTree as ET - from shutil import rmtree - # opens the existing extension manifest to get the Version attribute. with open(f"{target_path}/CSXS/manifest.xml", "rb") as xml_file: installed_version = ( - ET.parse(xml_file).find("*/Extension").attrib.get("Version") + ET.parse(xml_file) + .find("*/Extension") + .attrib.get("Version") ) - self.log.debug(f"Current extension version found: {installed_version}") + self.log.debug( + f"Current extension version found: {installed_version}" + ) if not installed_version: self.log.warning( @@ -98,7 +106,9 @@ def _compare_extension_versions( with ZipFile(extension_path, "r") as archive: xml_file = archive.open("CSXS/manifest.xml") new_version = ( - ET.parse(xml_file).find("*/Extension").attrib.get("Version") + ET.parse(xml_file) + .find("*/Extension") + .attrib.get("Version") ) if not new_version: self.log.warning( @@ -106,14 +116,17 @@ def _compare_extension_versions( ) self.log.debug(f"New extension version found: {new_version}") - # compare the two versions, a simple == is enough since the we don't care if the - # version increments or decrements, if they match nothing happens. + # compare the two versions, a simple == is enough since + # we don't care if the version increments or decrements + # if they match nothing happens. if installed_version == new_version: self.log.info("Versions matched. Cancelling..") return False # remove the existing addon to prevent any side effects when unzipping later. - self.log.info("Version mismatch found. Removing old extensions..") + self.log.info( + "Version mismatch found. Removing old extensions.." + ) rmtree(target_path) return True @@ -124,7 +137,9 @@ def _compare_extension_versions( return False except OSError as error: - self.log.warning(f"OS error has occured while comparing versions: {error}") + self.log.warning( + f"OS error has occured while comparing versions: {error}" + ) return False except Exception as error: From 161e6524cdc15fef9e81516eebfccea305dba24a Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 21 Jan 2025 13:36:52 +0000 Subject: [PATCH 26/30] refactor: 79line limit --- server/settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/settings.py b/server/settings.py index 93a6d4d..d7e58e8 100644 --- a/server/settings.py +++ b/server/settings.py @@ -13,7 +13,9 @@ class HooksModel(BaseSettingsModel): class PremiereSettings(BaseSettingsModel): - hooks: HooksModel = SettingsField(default_factory=HooksModel, title="Hooks") + hooks: HooksModel = SettingsField( + default_factory=HooksModel, title="Hooks" + ) DEFAULT_VALUES = { From 63430a63017ea6b5b864ea2bde02070244b4995c Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 21 Jan 2025 15:04:21 +0100 Subject: [PATCH 27/30] Update line widths --- .../hooks/pre_launch_install_ayon_extension.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 2ec3f6e..8069ee0 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -54,10 +54,11 @@ def inner_execute(self): r"api\extension.zxp", ) - # Extension already installed, compare the versions to see if we need to replace + # Extension already installed, compare the versions if os.path.exists(target_path): self.log.info( - f"The extension already exists at: {target_path}. Comparing versions.." + f"The extension already exists at: {target_path}. " + f"Comparing versions.." ) if not self._compare_extension_versions( target_path, extension_path @@ -85,7 +86,7 @@ def _compare_extension_versions( self, target_path: str, extension_path: str ) -> bool: try: - # opens the existing extension manifest to get the Version attribute. + # opens the existing extension manifest to get the Version attr with open(f"{target_path}/CSXS/manifest.xml", "rb") as xml_file: installed_version = ( ET.parse(xml_file) @@ -98,7 +99,8 @@ def _compare_extension_versions( if not installed_version: self.log.warning( - "Unable to resolve the currently installed extension version. Cancelling.." + "Unable to resolve the currently installed extension " + "version. Cancelling.." ) return False @@ -112,7 +114,8 @@ def _compare_extension_versions( ) if not new_version: self.log.warning( - "Unable to resolve the new extension version. Cancelling.." + "Unable to resolve the new extension version. " + "Cancelling.." ) self.log.debug(f"New extension version found: {new_version}") @@ -123,7 +126,7 @@ def _compare_extension_versions( self.log.info("Versions matched. Cancelling..") return False - # remove the existing addon to prevent any side effects when unzipping later. + # remove the existing addon self.log.info( "Version mismatch found. Removing old extensions.." ) @@ -132,7 +135,8 @@ def _compare_extension_versions( except PermissionError as error: self.log.warning( - f"Permissions error has occured while comparing versions: {error}" + "Permissions error has occurred while comparing " + f"versions: {error}" ) return False From 03ec0e415f6d0485ae44e0a8eb329bb08cd4a548 Mon Sep 17 00:00:00 2001 From: Jack P Date: Tue, 21 Jan 2025 15:09:28 +0000 Subject: [PATCH 28/30] fix: looking at incorrect version attribute --- .../hooks/pre_launch_install_ayon_extension.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index 8069ee0..d461de5 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -89,9 +89,7 @@ def _compare_extension_versions( # opens the existing extension manifest to get the Version attr with open(f"{target_path}/CSXS/manifest.xml", "rb") as xml_file: installed_version = ( - ET.parse(xml_file) - .find("*/Extension") - .attrib.get("Version") + ET.parse(xml_file).getroot().attrib.get("ExtensionBundleVersion") ) self.log.debug( f"Current extension version found: {installed_version}" @@ -108,9 +106,7 @@ def _compare_extension_versions( with ZipFile(extension_path, "r") as archive: xml_file = archive.open("CSXS/manifest.xml") new_version = ( - ET.parse(xml_file) - .find("*/Extension") - .attrib.get("Version") + ET.parse(xml_file).getroot().attrib.get("ExtensionBundleVersion") ) if not new_version: self.log.warning( From dd477729d40cd563ccb674997239e27a614a419c Mon Sep 17 00:00:00 2001 From: Sponge Date: Tue, 21 Jan 2025 15:10:28 +0000 Subject: [PATCH 29/30] refactor: line limit (again..) --- .../hooks/pre_launch_install_ayon_extension.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py index d461de5..cdbfc18 100644 --- a/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py +++ b/client/ayon_premiere/hooks/pre_launch_install_ayon_extension.py @@ -89,7 +89,9 @@ def _compare_extension_versions( # opens the existing extension manifest to get the Version attr with open(f"{target_path}/CSXS/manifest.xml", "rb") as xml_file: installed_version = ( - ET.parse(xml_file).getroot().attrib.get("ExtensionBundleVersion") + ET.parse(xml_file) + .getroot() + .attrib.get("ExtensionBundleVersion") ) self.log.debug( f"Current extension version found: {installed_version}" @@ -106,7 +108,9 @@ def _compare_extension_versions( with ZipFile(extension_path, "r") as archive: xml_file = archive.open("CSXS/manifest.xml") new_version = ( - ET.parse(xml_file).getroot().attrib.get("ExtensionBundleVersion") + ET.parse(xml_file) + .getroot() + .attrib.get("ExtensionBundleVersion") ) if not new_version: self.log.warning( From 68f3b87bc29411a3c831fb021ffb1a173bdcfe78 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 22 Jan 2025 10:34:07 +0100 Subject: [PATCH 30/30] Removed unnecessary version, ExtensionBundleVersion should be used --- client/ayon_premiere/api/extension.zxp | Bin 104224 -> 104221 bytes .../api/extension/CSXS/manifest.xml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_premiere/api/extension.zxp b/client/ayon_premiere/api/extension.zxp index f146f105e1ca8221bc60bc35a26c9b4815f33acd..e8dca552bbc167c29ebbc6b75440ed803ff2b2a1 100644 GIT binary patch delta 3618 zcmZuz1yod97ruuMMM97qIweJax;v$D01=ddp~D~qMkI})2Dk#EfrE z;USHPO2ZHM-v9j9diSn#&v$p6v)4X*uk$@CAhV(Ofx4 zWJz-jROuLqj)4_}#z~^(AY3|EAn#;xoXeq=3pc{f#l(P^2F;HblT|zh%;YDPG@_k%cEMM~ohj=%p!J#`?F`PFB^pOTeKa zge68Q{kl`_%F15?oE87G8-)AAi8R$xdm|jtKtX|aRnLa^ratYPZ-n?L$*N4(u#u19 zRwAq<95@1tG*?Y-guZKuqcvMs#>~h+bUgi&7&T{=`|5e+Xt2I{Cbx12#)D^mpbPin zp6(RmwQhs)LagN;m!EjURgVVyp&zzx75sJeFXzg0>(8@W;B?YirZk@qpn9h)P% zbQ)bbP&<}#0L@Ime!bKA>2sw75va2qv3@*QMD}TKWmEo@$gZX-&7IyZMs6jtNfB#j{Tf* z{z{~??j>i+l$W|lqO+o0Een?!|bX1m6I=(Df+h@Ha+EAK4W$qBQa#S zJ6+XAtkgg1QnnrdHV#;hB{xF1uaxoiSY(x_tinW89DblWb4Pd$Y=qzI zpbra);+U2*^uX>T(z7%3?fqs`b#7i~AeaXmvSlCq$W!~yC{FyPPLtqpuXRU(9?oyvN*EpgmO-qSU36)i~BR|)CypzfAZ0;+3=o=je}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XS/manifest.xml b/client/ayon_premiere/api/extension/CSXS/manifest.xml index 368416a..78c99da 100644 --- a/client/ayon_premiere/api/extension/CSXS/manifest.xml +++ b/client/ayon_premiere/api/extension/CSXS/manifest.xml @@ -5,7 +5,7 @@ ExtensionBundleName="io.ynput.PPRO.panel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - +