From 5d584adb8e548a822f21c1a90986e4747856d7ba Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 20 Apr 2021 11:18:08 +0200 Subject: [PATCH] python 2 prelaunch hooks are used when `use_python_2` is True --- openpype/hooks/pre_python_2_prelaunch.py | 6 +++--- openpype/modules/ftrack/launch_hooks/pre_python2_vendor.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/openpype/hooks/pre_python_2_prelaunch.py b/openpype/hooks/pre_python_2_prelaunch.py index 8232f35623..84272d2e5d 100644 --- a/openpype/hooks/pre_python_2_prelaunch.py +++ b/openpype/hooks/pre_python_2_prelaunch.py @@ -4,12 +4,12 @@ from openpype.lib import PreLaunchHook class PrePython2Vendor(PreLaunchHook): """Prepend python 2 dependencies for py2 hosts.""" - # WARNING This hook will probably be deprecated in OpenPype 3 - kept for - # test order = 10 - app_groups = ["hiero", "nuke", "nukex", "unreal", "maya", "houdini"] def execute(self): + if not self.application.use_python_2: + return + # Prepare vendor dir path self.log.info("adding global python 2 vendor") pype_root = os.getenv("OPENPYPE_REPOS_ROOT") diff --git a/openpype/modules/ftrack/launch_hooks/pre_python2_vendor.py b/openpype/modules/ftrack/launch_hooks/pre_python2_vendor.py index f14857bc98..d34b6533fb 100644 --- a/openpype/modules/ftrack/launch_hooks/pre_python2_vendor.py +++ b/openpype/modules/ftrack/launch_hooks/pre_python2_vendor.py @@ -8,10 +8,13 @@ class PrePython2Support(PreLaunchHook): Path to vendor modules is added to the beggining of PYTHONPATH. """ - # There will be needed more granular filtering in future - app_groups = ["maya", "nuke", "nukex", "hiero", "nukestudio", "unreal"] def execute(self): + if not self.application.use_python_2: + return + + self.log.info("Adding Ftrack Python 2 packages to PYTHONPATH.") + # Prepare vendor dir path python_2_vendor = os.path.join(FTRACK_MODULE_DIR, "python2_vendor")