mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added prealunch hook that will add python 2 ftrack api modules to PYTHONPATH
This commit is contained in:
parent
710acc9fc2
commit
122d80709c
1 changed files with 27 additions and 0 deletions
27
pype/modules/ftrack/launch_hooks/pre_python2_vendor.py
Normal file
27
pype/modules/ftrack/launch_hooks/pre_python2_vendor.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import os
|
||||
from pype.lib import PreLaunchHook
|
||||
from pype.modules.ftrack import FTRACK_MODULE_DIR
|
||||
|
||||
|
||||
class PrePyhton2Support(PreLaunchHook):
|
||||
"""Add python ftrack api module for Python 2 to PYTHONPATH.
|
||||
|
||||
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"]
|
||||
|
||||
def execute(self):
|
||||
# Prepare dir path
|
||||
python2_vendor = os.path.join(FTRACK_MODULE_DIR, "python2_vendor")
|
||||
# Load PYTHONPATH from current launch context
|
||||
python_path = self.launch_context.env.get("PYTHONPATH")
|
||||
|
||||
# Just override if PYTHONPATH is not set yet
|
||||
if not python_path:
|
||||
python_path = python2_vendor
|
||||
else:
|
||||
python_path = os.pathsep.join([python2_vendor, python_path])
|
||||
|
||||
# Set new PYTHONPATH to launch context environments
|
||||
self.launch_context.env["PYTHONPATH"] = python_path
|
||||
Loading…
Add table
Add a link
Reference in a new issue