Merge pull request #1354 from pypeclub/feature/remove_python_2_prelaunch

Remove Python 2 prelaunch hook
This commit is contained in:
Milan Kolar 2021-04-15 16:10:52 +02:00 committed by GitHub
commit ff10c84fd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 39 deletions

View file

@ -1,34 +0,0 @@
import os
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):
# Prepare vendor dir path
self.log.info("adding global python 2 vendor")
pype_root = os.getenv("OPENPYPE_REPOS_ROOT")
python_2_vendor = os.path.join(
pype_root,
"openpype",
"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)

View file

@ -6,11 +6,15 @@ import sys
import os
import site
# add Python version specific vendor folder
site.addsitedir(
os.path.join(
os.getenv("OPENPYPE_REPOS_ROOT", ""),
"vendor", "python", "python_{}".format(sys.version[0])))
# Add Python version specific vendor folder
python_version_dir = os.path.join(
os.getenv("OPENPYPE_REPOS_ROOT", ""),
"openpype", "vendor", "python", "python_{}".format(sys.version[0])
)
# Prepend path in sys paths
sys.path.insert(0, python_version_dir)
site.addsitedir(python_version_dir)
from .env_tools import (
env_value_to_bool,