From 6c06eefaefa86314b524724eeb2d1809477d23b8 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 23 Jun 2021 10:24:11 +0200 Subject: [PATCH 1/4] added python vendor to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 221a2f2241..fa3fae1ad2 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ Temporary Items /dist/ /vendor/bin/* +/vendor/python/* /.venv /venv/ From 25a18e1bc1b74da8c05521411e50d405bd9a7fc6 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 23 Jun 2021 10:24:35 +0200 Subject: [PATCH 2/4] do not install PySide2 into subfolder --- tools/fetch_thirdparty_libs.ps1 | 2 +- tools/fetch_thirdparty_libs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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" From 64a1839c9d0f1632db45ccb5038816acc10046aa Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 23 Jun 2021 10:24:59 +0200 Subject: [PATCH 3/4] add vendor directory to sys.path in start.py --- start.py | 4 ++++ 1 file changed, 4 insertions(+) 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 From 39bf35429b7403735c3ff02025e78a7fc46aed5a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 23 Jun 2021 10:25:34 +0200 Subject: [PATCH 4/4] removed get_pyside2_location as is not needed inside openpype --- openpype/lib/import_utils.py | 15 --------------- 1 file changed, 15 deletions(-) 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)