mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
prepend python2 vendor for hiero and nuke
This commit is contained in:
parent
1d587e34df
commit
32d554b0b5
1 changed files with 36 additions and 0 deletions
36
pype/hooks/global/pre_python2_vendor.py
Normal file
36
pype/hooks/global/pre_python2_vendor.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import os
|
||||
from pype.lib import PreLaunchHook
|
||||
|
||||
|
||||
class PrePython2Vendor(PreLaunchHook):
|
||||
"""Prepend python 2 dependencies for py2 hosts."""
|
||||
# WARNING This hook will probably be deprecated in Pype 3 - kept for test
|
||||
order = 10
|
||||
app_groups = ["hiero", "nuke"]
|
||||
|
||||
def execute(self):
|
||||
# Prepare vendor dir path
|
||||
self.log.info(
|
||||
f"adding global python 2 vendor"
|
||||
)
|
||||
PYPE_ROOT = os.getenv("PYPE_ROOT")
|
||||
python_2_vendor = os.path.join(
|
||||
PYPE_ROOT,
|
||||
"pype",
|
||||
"vendor",
|
||||
"python",
|
||||
"python_2"
|
||||
)
|
||||
|
||||
# Add Python 2 modules
|
||||
python_paths = [
|
||||
python_2_vendor
|
||||
]
|
||||
|
||||
# Load PYTHONPATH from current launch context
|
||||
python_path = self.launch_context.env.get("PYTHONPATH")
|
||||
if python_path:
|
||||
python_paths.append(python_path)
|
||||
|
||||
# Set new PYTHONPATH to launch context environments
|
||||
self.launch_context.env["PYTHONPATH"] = os.pathsep.join(python_paths)
|
||||
Loading…
Add table
Add a link
Reference in a new issue