modified adding paths from archive to sys path

This commit is contained in:
Jakub Trllo 2022-04-22 11:32:48 +02:00
parent 38d93c1b46
commit 4bae7484fa
2 changed files with 3 additions and 21 deletions

View file

@ -1057,27 +1057,11 @@ class BootstrapRepos:
if not archive.is_file() and not archive.exists():
raise ValueError("Archive is not file.")
with ZipFile(archive, "r") as zip_file:
name_list = zip_file.namelist()
roots = []
paths = []
for item in name_list:
if not item.startswith("repos/"):
continue
root = item.split("/")[1]
if root not in roots:
roots.append(root)
paths.append(
f"{archive}{os.path.sep}repos{os.path.sep}{root}")
sys.path.insert(0, paths[-1])
sys.path.insert(0, f"{archive}")
archive_path = str(archive)
sys.path.insert(0, archive_path)
pythonpath = os.getenv("PYTHONPATH", "")
python_paths = pythonpath.split(os.pathsep)
python_paths += paths
python_paths.insert(0, archive_path)
os.environ["PYTHONPATH"] = os.pathsep.join(python_paths)

View file

@ -152,8 +152,6 @@ def test_install_live_repos(fix_bootstrap, printer, monkeypatch, pytestconfig):
openpype_version = fix_bootstrap.create_version_from_live_code()
sep = os.path.sep
expected_paths = [
f"{openpype_version.path}{sep}repos{sep}avalon-core",
f"{openpype_version.path}{sep}repos{sep}avalon-unreal-integration",
f"{openpype_version.path}"
]
printer("testing zip creation")