diff --git a/.gitignore b/.gitignore index d2c682b1e5..63d311f033 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ Temporary Items /dist/ /vendor/bin/* +/vendor/python/* /.venv /venv/ diff --git a/openpype/lib/import_utils.py b/openpype/lib/import_utils.py index 9f459bbb51..4e72618803 100644 --- a/openpype/lib/import_utils.py +++ b/openpype/lib/import_utils.py @@ -2,7 +2,6 @@ import os import sys import importlib from .log import PypeLogger as Logger -from pathlib import Path log = Logger().get_logger(__name__) @@ -24,17 +23,3 @@ def discover_host_vendor_module(module_name): sys.path.insert(1, module_path) return importlib.import_module(module_name) - - -def get_pyside2_location(): - """Get location of PySide2 and its dependencies. - - Returned path can be used with `site.addsitedir()` - - Returns: - str: path to PySide2 - - """ - path = Path(os.getenv("OPENPYPE_ROOT")) - path = path / "vendor/python/PySide2" - return str(path) diff --git a/start.py b/start.py index 8e7c195e95..905526480f 100644 --- a/start.py +++ b/start.py @@ -124,6 +124,10 @@ else: paths.append(frozen_libs) os.environ["PYTHONPATH"] = os.pathsep.join(paths) +# Vendored python modules that must not be in PYTHONPATH environment but +# are required for OpenPype processes +vendor_python_path = os.path.join(OPENPYPE_ROOT, "vendor", "python") +sys.path.insert(0, vendor_python_path) import blessed # noqa: E402 import certifi # noqa: E402 diff --git a/tools/fetch_thirdparty_libs.ps1 b/tools/fetch_thirdparty_libs.ps1 index 7ece9ee10e..f87ce3e724 100644 --- a/tools/fetch_thirdparty_libs.ps1 +++ b/tools/fetch_thirdparty_libs.ps1 @@ -38,7 +38,7 @@ if (-not (Test-Path -PathType Container -Path "$openpype_root\.poetry\bin")) { } Write-Host ">>> " -NoNewline -ForegroundColor Green Write-Host "Installing PySide2 ... " -& "$($env:POETRY_HOME)\bin\poetry.bat" run python -m pip install PySide2 -t "$($openpype_root)\vendor\python\PySide2" +& "$($env:POETRY_HOME)\bin\poetry.bat" run python -m pip install PySide2 -t "$($openpype_root)\vendor\python" & poetry run python "$($openpype_root)\tools\fetch_thirdparty_libs.py" Set-Location -Path $current_dir diff --git a/tools/fetch_thirdparty_libs.sh b/tools/fetch_thirdparty_libs.sh index e5c79b81dc..f619bc9f01 100755 --- a/tools/fetch_thirdparty_libs.sh +++ b/tools/fetch_thirdparty_libs.sh @@ -100,7 +100,7 @@ main () { pushd "$openpype_root" > /dev/null || return > /dev/null echo -e "${BIGreen}>>>${RST} Installing PySide2 ..." - "$POETRY_HOME/bin/poetry" run python -m pip install PySide2 -t "$openpype_root/vendor/python/PySide2" + "$POETRY_HOME/bin/poetry" run python -m pip install PySide2 -t "$openpype_root/vendor/python" echo -e "${BIGreen}>>>${RST} Running Pype tool ..." poetry run python "$openpype_root/tools/fetch_thirdparty_libs.py"