From da23775c2524a3c544cbf4695316146f23644d05 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 26 Mar 2021 16:45:15 +0100 Subject: [PATCH 1/8] win: run mongo script improvements --- tools/run_mongo.ps1 | 61 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/tools/run_mongo.ps1 b/tools/run_mongo.ps1 index a72c8b1210..f04234d56a 100644 --- a/tools/run_mongo.ps1 +++ b/tools/run_mongo.ps1 @@ -37,37 +37,37 @@ function Exit-WithCode($exitcode) { function Find-Mongo { - Write-Host ">>> " -NoNewLine -ForegroundColor Green - Write-Host "Detecting MongoDB ... " -NoNewline - if (-not (Get-Command "mongod" -ErrorAction SilentlyContinue)) { - if(Test-Path 'C:\Program Files\MongoDB\Server\*\bin\mongod.exe' -PathType Leaf) { - # we have mongo server installed on standard Windows location - # so we can inject it to the PATH. We'll use latest version available. - $mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]} - if(Test-Path "$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) { - $env:PATH="$($env:PATH);$($mongoVersions[-1])\bin\" - Write-Host "OK" -ForegroundColor Green - Write-Host " - auto-added from [ " -NoNewline - Write-Host "$($mongoVersions[-1])\bin\" -NoNewLine -ForegroundColor Cyan - Write-Host " ]" - } else { - Write-Host "FAILED " -NoNewLine -ForegroundColor Red - Write-Host "MongoDB not detected" -ForegroundColor Yellow - Write-Host "Tried to find it on standard location " -NoNewline -ForegroundColor Gray - Write-Host " [ " -NoNewline -ForegroundColor Cyan - Write-Host "$($mongoVersions[-1])\bin\" -NoNewline -ForegroundColor White - Write-Host " ] " -NonNewLine -ForegroundColor Cyan - Write-Host "but failed." -ForegroundColor Gray - Exit-WithCode 1 - } + $defaultPath = "C:\Program Files\MongoDB\Server" + Write-Host ">>> " -NoNewLine -ForegroundColor Green + Write-Host "Detecting MongoDB ... " -NoNewline + if (-not (Get-Command "mongod" -ErrorAction SilentlyContinue)) { + if(Test-Path "$($defaultPath)\*\bin\mongod.exe" -PathType Leaf) { + # we have mongo server installed on standard Windows location + # so we can inject it to the PATH. We'll use latest version available. + $mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]} + if(Test-Path "$($defaultPath)\$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) { + $env:PATH="$($env:PATH);$($defaultPath)\$($mongoVersions[-1])\bin\" + Write-Host "OK" -ForegroundColor Green + Write-Host " - auto-added from [ " -NoNewline + Write-Host "$($defaultPath)\$($mongoVersions[-1])\bin\" -NoNewLine -ForegroundColor Cyan + Write-Host " ]" + } else { + Write-Host "FAILED " -NoNewLine -ForegroundColor Red + Write-Host "MongoDB not detected" -ForegroundColor Yellow + Write-Host "Tried to find it on standard location " -NoNewline -ForegroundColor Gray + Write-Host " [ " -NoNewline -ForegroundColor Cyan + Write-Host "$($defaultPath)\$($mongoVersions[-1])\bin\" -NoNewline -ForegroundColor White + Write-Host " ] " -NonNewLine -ForegroundColor Cyan + Write-Host "but failed." -ForegroundColor Gray + Exit-WithCode 1 + } } else { - Write-Host "FAILED " -NoNewLine -ForegroundColor Red - Write-Host "MongoDB not detected in PATH" -ForegroundColor Yellow - Exit-WithCode 1 + Write-Host "FAILED " -NoNewLine -ForegroundColor Red + Write-Host "MongoDB not detected in PATH" -ForegroundColor Yellow + Exit-WithCode 1 } - } else { - Write-Host "OK" -ForegroundColor Green + Write-Host "OK" -ForegroundColor Green } <# .SYNOPSIS @@ -90,4 +90,7 @@ $dbpath = (Get-Item $pype_root).parent.FullName + "\mongo_db_data" Find-Mongo $mongo = Get-Command "mongod" | Select-Object -ExpandProperty Definition -Start-Process -FilePath $mongo "--dbpath $($dbpath) --port $($port)" +$process = Start-Process -FilePath $mongo "--dbpath $($dbpath) --port $($port)" -PassThru -NoNewWindow -Wait +$process.WaitForExit() +Start-Process PowerShell -NoNewWindow -Wait + From b9a6e093abd0efe35b069b16d093948c1aa9f2da Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 26 Mar 2021 16:49:18 +0100 Subject: [PATCH 2/8] better handle connection errors to db --- start.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/start.py b/start.py index 8d60a14403..c231786797 100644 --- a/start.py +++ b/start.py @@ -100,6 +100,8 @@ import subprocess import site from pathlib import Path +from pymongo.errors import ServerSelectionTimeoutError + # add dependencies folder to sys.pat for frozen code if getattr(sys, 'frozen', False): frozen_libs = os.path.normpath( @@ -569,7 +571,13 @@ def boot(): # Get Pype path from database and set it to environment so Pype can # find its versions there and bootstrap them. - pype_path = get_pype_path_from_db(pype_mongo) + try: + pype_path = get_pype_path_from_db(pype_mongo) + except ServerSelectionTimeoutError as e: + print("!!! Can't connect to mongodb database server.") + print("!!! {}".format(e)) + sys.exit(1) + if not os.getenv("PYPE_PATH") and pype_path: os.environ["PYPE_PATH"] = pype_path From a427e96ecf34b6d03a9e71f35017c38af7c41836 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 26 Mar 2021 17:04:27 +0100 Subject: [PATCH 3/8] fixed broken tests --- tests/igniter/test_bootstrap_repos.py | 16 ++++++++-------- tests/igniter/test_tools.py | 4 ---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/igniter/test_bootstrap_repos.py b/tests/igniter/test_bootstrap_repos.py index 70edc5b89c..e1bdbffb30 100644 --- a/tests/igniter/test_bootstrap_repos.py +++ b/tests/igniter/test_bootstrap_repos.py @@ -145,18 +145,18 @@ def test_search_string_for_pype_version(printer): assert PypeVersion.version_in_str(ver_string[0])[0] == ver_string[1] +@pytest.mark.slow def test_install_live_repos(fix_bootstrap, printer): - rf = fix_bootstrap.create_version_from_live_code() + pype_version = fix_bootstrap.create_version_from_live_code() sep = os.path.sep expected_paths = [ - f"{rf}{sep}avalon-core", - f"{rf}{sep}avalon-unreal-integration", - f"{rf}{sep}maya-look-assigner", - f"{rf}{sep}pype" + f"{pype_version.path}{sep}avalon-core", + f"{pype_version.path}{sep}avalon-unreal-integration", + f"{pype_version.path}{sep}pype" ] printer("testing zip creation") - assert os.path.exists(rf), "zip archive was not created" - fix_bootstrap.add_paths_from_archive(rf) + assert os.path.exists(pype_version.path), "zip archive was not created" + fix_bootstrap.add_paths_from_archive(pype_version.path) for ep in expected_paths: assert ep in sys.path, f"{ep} not set correctly" @@ -168,7 +168,7 @@ def test_install_live_repos(fix_bootstrap, printer): print(pype.__file__) assert "pype" in sys.modules.keys(), "Pype not imported" assert sys.modules["pype"].__file__ == \ - f"{rf}{sep}pype{sep}pype{sep}__init__.py" + f"{pype_version.path}{sep}pype{sep}pype{sep}__init__.py" def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer): diff --git a/tests/igniter/test_tools.py b/tests/igniter/test_tools.py index b87900311a..0c7104f698 100644 --- a/tests/igniter/test_tools.py +++ b/tests/igniter/test_tools.py @@ -10,7 +10,3 @@ def test_validate_path_string(tmp_path): status2, _ = validate_path_string("booo" + str(uuid4())) assert status2 is False - # todo: change when Pype token is implemented - status3, reason = validate_path_string(str(uuid4())) - assert status3 is False - assert reason == "Not implemented yet" From 8d61529fb001c6aecdbb3b9c4903cf139ec8b721 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Mon, 29 Mar 2021 13:55:43 +0200 Subject: [PATCH 4/8] mimic source hierarchy in zips for frozen and live code --- igniter/bootstrap_repos.py | 139 ++++++++++---------------- igniter/tools.py | 5 + start.py | 14 +-- tests/igniter/test_bootstrap_repos.py | 13 ++- 4 files changed, 71 insertions(+), 100 deletions(-) diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py index 58d59afe88..2ef22ec4fa 100644 --- a/igniter/bootstrap_repos.py +++ b/igniter/bootstrap_repos.py @@ -242,7 +242,7 @@ class BootstrapRepos: self.registry = PypeSettingsRegistry() self.zip_filter = [".pyc", "__pycache__"] self.pype_filter = [ - "build", "docs", "tests", "repos", "tools", "venv" + "build", "docs", "tests", "tools", "venv", "coverage" ] self._message = message @@ -351,7 +351,7 @@ class BootstrapRepos: Path(temp_dir) / f"pype-v{version}.zip" self._print(f"creating zip: {temp_zip}") - self._create_pype_zip(temp_zip, repo_dir) + self._create_pype_zip(temp_zip, repo_dir.parent) if not os.path.exists(temp_zip): self._print("make archive failed.", LOG_ERROR) return None @@ -417,15 +417,14 @@ class BootstrapRepos: """ frozen_root = Path(sys.executable).parent - repo_dir = frozen_root / "repos" - repo_list = self._filter_dir( - repo_dir, self.zip_filter) # from frozen code we need igniter, pype, schema vendor pype_list = self._filter_dir( frozen_root / "pype", self.zip_filter) pype_list += self._filter_dir( frozen_root / "igniter", self.zip_filter) + pype_list += self._filter_dir( + frozen_root / "repos", self.zip_filter) pype_list += self._filter_dir( frozen_root / "schema", self.zip_filter) pype_list += self._filter_dir( @@ -443,17 +442,7 @@ class BootstrapRepos: with ZipFile(temp_zip, "w") as zip_file: progress = 0 - repo_inc = 48.0 / float(len(repo_list)) - file: Path - for file in repo_list: - progress += repo_inc - self._progress_callback(int(progress)) - - # archive name is relative to repos dir - arc_name = file.relative_to(repo_dir) - zip_file.write(file, arc_name) - - pype_inc = 48.0 / float(len(pype_list)) + pype_inc = 98.0 / float(len(pype_list)) file: Path for file in pype_list: progress += pype_inc @@ -463,17 +452,14 @@ class BootstrapRepos: # we need to replace first part of path which starts with # something like `exe.win/linux....` with `pype` as this # is expected by Pype in zip archive. - arc_name = Path("pype").joinpath(*arc_name.parts[1:]) + arc_name = Path().joinpath(*arc_name.parts[1:]) zip_file.write(file, arc_name) destination = self._move_zip_to_data_dir(temp_zip) return PypeVersion(version=version, path=destination) - def _create_pype_zip( - self, - zip_path: Path, include_dir: Path, - include_pype: bool = True) -> None: + def _create_pype_zip(self, zip_path: Path, pype_path: Path) -> None: """Pack repositories and Pype into zip. We are using :mod:`zipfile` instead :meth:`shutil.make_archive` @@ -482,70 +468,46 @@ class BootstrapRepos: and :attr:`pype_filter` on top level directory in Pype repository. Args: - zip_path (str): path to zip file. - include_dir (Path): repo directories to include. - include_pype (bool): add Pype module itself. + zip_path (Path): Path to zip file. + pype_path (Path): Path to Pype sources. """ - include_dir = include_dir.resolve() - pype_list = [] - # get filtered list of files in repositories (repos directory) - repo_list = self._filter_dir(include_dir, self.zip_filter) - # count them - repo_files = len(repo_list) - - # there must be some files, otherwise `include_dir` path is wrong - assert repo_files != 0, f"No repositories to include in {include_dir}" pype_inc = 0 - if include_pype: - # get filtered list of file in Pype repository - pype_list = self._filter_dir(include_dir.parent, self.zip_filter) - pype_files = len(pype_list) - repo_inc = 48.0 / float(repo_files) - pype_inc = 48.0 / float(pype_files) - else: - repo_inc = 98.0 / float(repo_files) + + # get filtered list of file in Pype repository + pype_list = self._filter_dir(pype_path, self.zip_filter) + pype_files = len(pype_list) + + pype_inc = 98.0 / float(pype_files) with ZipFile(zip_path, "w") as zip_file: progress = 0 + pype_root = pype_path.resolve() + # generate list of filtered paths + dir_filter = [pype_root / f for f in self.pype_filter] + file: Path - for file in repo_list: - progress += repo_inc + for file in pype_list: + progress += pype_inc self._progress_callback(int(progress)) - # archive name is relative to repos dir - arc_name = file.relative_to(include_dir) - zip_file.write(file, arc_name) + # if file resides in filtered path, skip it + is_inside = None + df: Path + for df in dir_filter: + try: + is_inside = file.resolve().relative_to(df) + except ValueError: + pass - # add pype itself - if include_pype: - pype_root = include_dir.parent.resolve() - # generate list of filtered paths - dir_filter = [pype_root / f for f in self.pype_filter] + if is_inside: + continue - file: Path - for file in pype_list: - progress += pype_inc - self._progress_callback(int(progress)) + processed_path = file + self._print(f"- processing {processed_path}") - # if file resides in filtered path, skip it - is_inside = None - df: Path - for df in dir_filter: - try: - is_inside = file.resolve().relative_to(df) - except ValueError: - pass - - if is_inside: - continue - - processed_path = file - self._print(f"- processing {processed_path}") - - zip_file.write(file, - "pype" / file.relative_to(pype_root)) + zip_file.write(file, file.relative_to(pype_root)) # test if zip is ok zip_file.testzip() @@ -553,10 +515,10 @@ class BootstrapRepos: @staticmethod def add_paths_from_archive(archive: Path) -> None: - """Add first-level directories as paths to :mod:`sys.path`. + """Add first-level directory and 'repos' as paths to :mod:`sys.path`. - This will enable Python to import modules is second-level directories - in zip file. + This will enable Python to import Pype and modules in `repos` + submodule directory in zip file. Adding to both `sys.path` and `PYTHONPATH`, skipping duplicates. @@ -574,21 +536,29 @@ class BootstrapRepos: name_list = zip_file.namelist() roots = [] + paths = [] for item in name_list: - root = item.split("/")[0] + if not item.startswith("repos/"): + continue + + root = item.split("/")[1] + if root not in roots: roots.append(root) - sys.path.insert(0, f"{archive}{os.path.sep}{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}") pythonpath = os.getenv("PYTHONPATH", "") - paths = pythonpath.split(os.pathsep) - paths += roots + python_paths = pythonpath.split(os.pathsep) + python_paths += paths - os.environ["PYTHONPATH"] = os.pathsep.join(paths) + os.environ["PYTHONPATH"] = os.pathsep.join(python_paths) @staticmethod def add_paths_from_directory(directory: Path) -> None: - """Add first level directories as paths to :mod:`sys.path`. + """Add repos first level directories as paths to :mod:`sys.path`. This works the same as :meth:`add_paths_from_archive` but in specified directory. @@ -599,6 +569,8 @@ class BootstrapRepos: directory (Path): path to directory. """ + sys.path.insert(0, directory.as_posix()) + directory = directory / "repos" if not directory.exists() and not directory.is_dir(): raise ValueError("directory is invalid") @@ -937,8 +909,7 @@ class BootstrapRepos: try: # add one 'pype' level as inside dir there should # be many other repositories. - version_str = BootstrapRepos.get_version( - dir_item / "pype") + version_str = BootstrapRepos.get_version(dir_item) version_check = PypeVersion(version=version_str) except ValueError: self._print( @@ -979,7 +950,7 @@ class BootstrapRepos: try: with ZipFile(zip_item, "r") as zip_file: with zip_file.open( - "pype/pype/version.py") as version_file: + "pype/version.py") as version_file: zip_version = {} exec(version_file.read(), zip_version) version_check = PypeVersion( diff --git a/igniter/tools.py b/igniter/tools.py index 4ed4ae67f4..17e53a2b07 100644 --- a/igniter/tools.py +++ b/igniter/tools.py @@ -6,6 +6,7 @@ Functions ``compose_url()`` and ``decompose_url()`` are the same as in version is decided. """ +import sys from typing import Dict, Union from urllib.parse import urlparse, parse_qs from pathlib import Path @@ -244,6 +245,10 @@ def get_pype_path_from_db(url: str) -> Union[str, None]: try: client = MongoClient(**mongo_args) + except ServerSelectionTimeoutError as e: + print("!!! Can't connect to mongodb database server.") + print("!!! {}".format(e)) + return None except Exception: return None diff --git a/start.py b/start.py index c231786797..8553449489 100644 --- a/start.py +++ b/start.py @@ -100,7 +100,6 @@ import subprocess import site from pathlib import Path -from pymongo.errors import ServerSelectionTimeoutError # add dependencies folder to sys.pat for frozen code if getattr(sys, 'frozen', False): @@ -327,13 +326,12 @@ def _initialize_environment(pype_version: PypeVersion) -> None: # to same hierarchy from code and from frozen pype additional_paths = [ # add pype tools - os.path.join(os.environ["PYPE_ROOT"], "pype", "pype", "tools"), + os.path.join(os.environ["PYPE_ROOT"], "pype", "tools"), # add common pype vendor # (common for multiple Python interpreter versions) os.path.join( os.environ["PYPE_ROOT"], "pype", - "pype", "vendor", "python", "common" @@ -571,12 +569,10 @@ def boot(): # Get Pype path from database and set it to environment so Pype can # find its versions there and bootstrap them. - try: - pype_path = get_pype_path_from_db(pype_mongo) - except ServerSelectionTimeoutError as e: - print("!!! Can't connect to mongodb database server.") - print("!!! {}".format(e)) - sys.exit(1) + + pype_path = get_pype_path_from_db(pype_mongo) + if not pype_path: + print("*** Cannot get Pype path from database.") if not os.getenv("PYPE_PATH") and pype_path: os.environ["PYPE_PATH"] = pype_path diff --git a/tests/igniter/test_bootstrap_repos.py b/tests/igniter/test_bootstrap_repos.py index e1bdbffb30..75996b4026 100644 --- a/tests/igniter/test_bootstrap_repos.py +++ b/tests/igniter/test_bootstrap_repos.py @@ -150,9 +150,9 @@ def test_install_live_repos(fix_bootstrap, printer): pype_version = fix_bootstrap.create_version_from_live_code() sep = os.path.sep expected_paths = [ - f"{pype_version.path}{sep}avalon-core", - f"{pype_version.path}{sep}avalon-unreal-integration", - f"{pype_version.path}{sep}pype" + f"{pype_version.path}{sep}repos{sep}avalon-core", + f"{pype_version.path}{sep}repos{sep}avalon-unreal-integration", + f"{pype_version.path}" ] printer("testing zip creation") assert os.path.exists(pype_version.path), "zip archive was not created" @@ -165,10 +165,9 @@ def test_install_live_repos(fix_bootstrap, printer): import pype # noqa: F401 # test if pype is imported from specific location in zip - print(pype.__file__) assert "pype" in sys.modules.keys(), "Pype not imported" assert sys.modules["pype"].__file__ == \ - f"{pype_version.path}{sep}pype{sep}pype{sep}__init__.py" + f"{pype_version.path}{sep}pype{sep}__init__.py" def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer): @@ -252,7 +251,7 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer): def _create_valid_zip(path: Path, version: str): with ZipFile(path, "w") as zf: zf.writestr( - "pype/pype/version.py", f"__version__ = '{version}'\n\n") + "pype/version.py", f"__version__ = '{version}'\n\n") def _create_invalid_dir(path: Path): path.mkdir(parents=True, exist_ok=True) @@ -260,7 +259,7 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer): fp.write("invalid") def _create_valid_dir(path: Path, version: str): - pype_path = path / "pype" / "pype" + pype_path = path / "pype" version_path = pype_path / "version.py" pype_path.mkdir(parents=True, exist_ok=True) with open(version_path, "w") as fp: From 69962606eeece4da071ed47821e972ae98635f6c Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Mon, 29 Mar 2021 13:56:21 +0200 Subject: [PATCH 5/8] partially revert changes in run_mongo --- tools/run_mongo.ps1 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/run_mongo.ps1 b/tools/run_mongo.ps1 index f04234d56a..66bd2656b9 100644 --- a/tools/run_mongo.ps1 +++ b/tools/run_mongo.ps1 @@ -45,19 +45,20 @@ function Find-Mongo { # we have mongo server installed on standard Windows location # so we can inject it to the PATH. We'll use latest version available. $mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]} - if(Test-Path "$($defaultPath)\$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) { - $env:PATH="$($env:PATH);$($defaultPath)\$($mongoVersions[-1])\bin\" + if(Test-Path "$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) { + $env:PATH = "$($env:PATH);$($mongoVersions[-1])\bin\" Write-Host "OK" -ForegroundColor Green Write-Host " - auto-added from [ " -NoNewline - Write-Host "$($defaultPath)\$($mongoVersions[-1])\bin\" -NoNewLine -ForegroundColor Cyan + Write-Host "$($mongoVersions[-1])\bin\mongod.exe" -NoNewLine -ForegroundColor Cyan Write-Host " ]" + return "$($mongoVersions[-1])\bin\mongod.exe" } else { Write-Host "FAILED " -NoNewLine -ForegroundColor Red Write-Host "MongoDB not detected" -ForegroundColor Yellow Write-Host "Tried to find it on standard location " -NoNewline -ForegroundColor Gray Write-Host " [ " -NoNewline -ForegroundColor Cyan - Write-Host "$($defaultPath)\$($mongoVersions[-1])\bin\" -NoNewline -ForegroundColor White - Write-Host " ] " -NonNewLine -ForegroundColor Cyan + Write-Host "$($mongoVersions[-1])\bin\mongod.exe" -NoNewline -ForegroundColor White + Write-Host " ] " -NoNewLine -ForegroundColor Cyan Write-Host "but failed." -ForegroundColor Gray Exit-WithCode 1 } @@ -68,6 +69,7 @@ function Find-Mongo { } } else { Write-Host "OK" -ForegroundColor Green + return Get-Command "mongod" -ErrorAction SilentlyContinue } <# .SYNOPSIS @@ -88,9 +90,7 @@ $port = 2707 # path to database $dbpath = (Get-Item $pype_root).parent.FullName + "\mongo_db_data" -Find-Mongo -$mongo = Get-Command "mongod" | Select-Object -ExpandProperty Definition -$process = Start-Process -FilePath $mongo "--dbpath $($dbpath) --port $($port)" -PassThru -NoNewWindow -Wait -$process.WaitForExit() -Start-Process PowerShell -NoNewWindow -Wait +$mongoPath = Find-Mongo +Start-Process -FilePath $mongopath "--dbpath $($dbpath) --port $($port)" -PassThru + From 69cafcddda9904b817092d006f70edc097e6a19c Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Thu, 1 Apr 2021 15:02:44 +0200 Subject: [PATCH 6/8] pype -> openpype in tools and scripts --- .gitignore | 2 +- poetry.lock | 4 +-- poetry.toml | 2 +- pyproject.toml | 22 +++++++------- setup.cfg | 2 +- setup.py | 20 ++++++------- start.py | 60 ++++++++++++++++++------------------- tools/build.ps1 | 60 ++++++++++++++++++------------------- tools/build.sh | 35 +++++++++++----------- tools/build_dependencies.py | 4 +-- tools/create_env.ps1 | 41 ++++++++++++------------- tools/create_env.sh | 26 ++++++++-------- tools/create_zip.ps1 | 36 +++++++++++----------- tools/create_zip.sh | 27 +++++++++-------- tools/make_docs.ps1 | 28 ++++++++--------- tools/make_docs.sh | 27 ++++++++--------- tools/run_mongo.ps1 | 17 +++++------ tools/run_mongo.sh | 19 ++++++------ tools/run_settings.ps1 | 10 +++---- tools/run_settings.sh | 23 +++++++------- tools/run_tests.ps1 | 45 +++++++++++++--------------- tools/run_tests.sh | 29 +++++++++--------- tools/run_tray.ps1 | 8 ++--- tools/run_tray.sh | 25 ++++++++-------- tools/update_submodules.ps1 | 24 ++++++--------- tools/update_submodules.sh | 14 ++++----- 26 files changed, 289 insertions(+), 321 deletions(-) diff --git a/.gitignore b/.gitignore index 47a37410e6..5dbefa2309 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,7 @@ coverage.xml node_modules/ package-lock.json -pype/premiere/ppro/js/debug.log +openpype/premiere/ppro/js/debug.log # IDEA diff --git a/poetry.lock b/poetry.lock index e6c08b8ae9..6695a7bcca 100644 --- a/poetry.lock +++ b/poetry.lock @@ -637,8 +637,8 @@ view = ["PySide2 (>=5.11,<6.0)"] [package.source] type = "legacy" -url = "https://d.r1.wbsprt.com/pype.club/distribute" -reference = "pype" +url = "https://distribute.openpype.io/wheels" +reference = "openpype" [[package]] name = "packaging" diff --git a/poetry.toml b/poetry.toml index f05df6491a..19eca443f8 100644 --- a/poetry.toml +++ b/poetry.toml @@ -2,4 +2,4 @@ in-project = true [repositories.pype] -url = "http://d.r1.wbsprt.com/pype.club/distribute/" +url = "https://distribute.openpype.io/wheels/" diff --git a/pyproject.toml b/pyproject.toml index b6ca6574c4..ec2d9c7e3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] -name = "Pype" +name = "OpenPype" version = "3.0.0-alpha1" description = "Multi-platform open-source pipeline built around the Avalon platform, expanding it with extra features and integrations." -authors = ["Pype Club "] +authors = ["OpenPype Team "] license = "MIT License" -homepage = "https://pype.club" -documentation = "https://pype.club/docs/artist_getting_started" -repository = "https://github.com/pypeclub/pype" +homepage = "https://openpype.io" +documentation = "https://openpype.io/docs/artist_getting_started" +repository = "https://github.com/pypeclub/openpype" readme = "README.md" keywords = ["Pipeline", "Avalon", "VFX", "animation", "automation", "tracking", "asset management"] @@ -15,9 +15,9 @@ python = "3.7.*" aiohttp = "^3.7" aiohttp_json_rpc = "*" # TVPaint server acre = { git = "https://github.com/pypeclub/acre.git" } -opentimelineio = { version = "0.14.0.dev1", source = "pype" } +opentimelineio = { version = "0.14.0.dev1", source = "openpype" } appdirs = "^1.4.3" -blessed = "^1.17" # pype terminal formatting +blessed = "^1.17" # openpype terminal formatting clique = "1.5.*" Click = "^7" dnspython = "^2.1.0" @@ -65,12 +65,12 @@ tqdm = "*" wheel = "*" [tool.poetry.urls] -"Bug Tracker" = "https://github.com/pypeclub/pype/issues" -"Discussions" = "https://github.com/pypeclub/pype/discussions" +"Bug Tracker" = "https://github.com/pypeclub/openpype/issues" +"Discussions" = "https://github.com/pypeclub/openpype/discussions" [[tool.poetry.source]] -name = "pype" -url = "https://d.r1.wbsprt.com/pype.club/distribute/" +name = "openpype" +url = "https://distribute.openpype.io/wheels/" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/setup.cfg b/setup.cfg index bc66f0c4d5..03c999e05f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,4 +25,4 @@ omit = /tests directory = ./coverage [tool:pytest] -norecursedirs = repos/* pype/modules/ftrack/* \ No newline at end of file +norecursedirs = repos/* openpype/modules/ftrack/* \ No newline at end of file diff --git a/setup.py b/setup.py index e3be48d6e0..1c98935000 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ from sphinx.setup_command import BuildDoc version = {} -pype_root = Path(os.path.dirname(__file__)) +openpype_root = Path(os.path.dirname(__file__)) -with open(pype_root / "pype" / "version.py") as fp: +with open(openpype_root / "pype" / "version.py") as fp: exec(fp.read(), version) version_match = re.search(r"(\d+\.\d+.\d+).*", version["__version__"]) @@ -53,7 +53,7 @@ excludes = [] bin_includes = [] include_files = [ "igniter", - "pype", + "openpype", "repos", "schema", "vendor", @@ -78,28 +78,28 @@ build_options = dict( optimize=0 ) -icon_path = pype_root / "igniter" / "pype.ico" +icon_path = openpype_root / "igniter" / "pype.ico" executables = [ Executable("start.py", base=None, - target_name="pype_console", icon=icon_path.as_posix()), + target_name="openpype_console", icon=icon_path.as_posix()), Executable("start.py", base=base, - target_name="pype_gui", icon=icon_path.as_posix()) + target_name="openpype_gui", icon=icon_path.as_posix()) ] setup( - name="pype", + name="OpenPype", version=__version__, description="Ultimate pipeline", cmdclass={"build_sphinx": BuildDoc}, options={ "build_exe": build_options, "build_sphinx": { - "project": "Pype", + "project": "OpenPype", "version": __version__, "release": __version__, - "source_dir": (pype_root / "docs" / "source").as_posix(), - "build_dir": (pype_root / "docs" / "build").as_posix() + "source_dir": (openpype_root / "docs" / "source").as_posix(), + "build_dir": (openpype_root / "docs" / "build").as_posix() } }, executables=executables diff --git a/start.py b/start.py index 8d60a14403..dd9e81a698 100644 --- a/start.py +++ b/start.py @@ -1,46 +1,46 @@ # -*- coding: utf-8 -*- -"""Main entry point for Pype command. +"""Main entry point for OpenPype command. -Bootstrapping process of Pype is as follows: +Bootstrapping process of OpenPype is as follows: -`PYPE_PATH` is checked for existence - either one from environment or +`OPENPYPE_PATH` is checked for existence - either one from environment or from user settings. Precedence takes the one set by environment. -On this path we try to find pype in directories version string in their names. -For example: `pype-v3.0.1-foo` is valid name, or even `foo_3.0.2` - as long -as version can be determined from its name _AND_ file `pype/pype/version.py` -can be found inside, it is considered Pype installation. +On this path we try to find OpenPype in directories version string in their names. +For example: `openpype-v3.0.1-foo` is valid name, or even `foo_3.0.2` - as long +as version can be determined from its name _AND_ file `openpype/openpype/version.py` +can be found inside, it is considered OpenPype installation. -If no Pype repositories are found in `PYPE_PATH` (user data dir) -then **Igniter** (Pype setup tool) will launch its GUI. +If no OpenPype repositories are found in `OPENPYPE_PATH` (user data dir) +then **Igniter** (OpenPype setup tool) will launch its GUI. -It can be used to specify `PYPE_PATH` or if it is _not_ specified, current +It can be used to specify `OPENPYPE_PATH` or if it is _not_ specified, current *"live"* repositories will be used to create zip file and copy it to appdata dir in user home and extract it there. Version will be determined by -version specified in Pype module. +version specified in OpenPype module. -If Pype repository directories are found in default install location -(user data dir) or in `PYPE_PATH`, it will get list of those dirs there and +If OpenPype repository directories are found in default install location +(user data dir) or in `OPENPYPE_PATH`, it will get list of those dirs there and use latest one or the one specified with optional `--use-version` command line argument. If the one specified doesn't exist then latest available version will be used. All repositories in that dir will be added to `sys.path` and `PYTHONPATH`. -If Pype is live (not frozen) then current version of Pype module will be +If OpenPype is live (not frozen) then current version of OpenPype module will be used. All directories under `repos` will be added to `sys.path` and `PYTHONPATH`. -Pype depends on connection to `MongoDB`_. You can specify MongoDB connection -string via `PYPE_MONGO` set in environment or it can be set in user +OpenPype depends on connection to `MongoDB`_. You can specify MongoDB connection +string via `OPENPYPE_MONGO` set in environment or it can be set in user settings or via **Igniter** GUI. -So, bootstrapping Pype looks like this:: +So, bootstrapping OpenPype looks like this:: .. code-block:: bash +-------------------------------------------------------+ | Determine MongoDB connection: | -| Use `PYPE_MONGO`, system keyring `pypeMongo` | +| Use `OPENPYPE_MONGO`, system keyring `openPypeMongo` | +--------------------------|----------------------------+ .--- Found? --. YES NO @@ -52,9 +52,9 @@ So, bootstrapping Pype looks like this:: | | | | +-----------------v------------------------------------+ | -| Get location of Pype: | | -| 1) Test for `PYPE_PATH` environment variable | | -| 2) Test `pypePath` in registry setting | | +| Get location of OpenPype: | | +| 1) Test for `OPENPYPE_PATH` environment variable | | +| 2) Test `openPypePath` in registry setting | | | 3) Test user data directory | | | ................................................... | | | If running from frozen code: | | @@ -63,21 +63,21 @@ So, bootstrapping Pype looks like this:: | - Use live code and install it to user data dir | | | * can be overridden with `--use-version` argument | | +-------------------------|----------------------------+ | - .-- Is Pype found? --. | - YES NO | - | | | - | +--------------v------------------+ | - | | Look in `PYPE_PATH`, find | | + .-- Is OpenPype found? --. | + YES NO | + | | | + | +---------------v-----------------+ | + | | Look in `OPENPYPE_PATH`, find | | | | latest version and install it | | | | to user data dir. | | | +--------------|------------------+ | - | .-- Is Pype found? --. | - | YES NO ---------+ + | .-- Is OpenPype found? --. | + | YES NO --------+ | | |<---------+ | +-------------v------------+ -| Run Pype | +| Run OpenPype | +--------------------------+ @@ -85,7 +85,7 @@ Todo: Move or remove bootstrapping environments out of the code. Attributes: - silent_commands (list): list of commands for which we won't print Pype + silent_commands (list): list of commands for which we won't print OpenPype logo and info header. .. _MongoDB: diff --git a/tools/build.ps1 b/tools/build.ps1 index e0a74bbaa3..70e6b68377 100644 --- a/tools/build.ps1 +++ b/tools/build.ps1 @@ -1,11 +1,12 @@ <# .SYNOPSIS - Helper script to build Pype. + Helper script to build OpenPype. .DESCRIPTION - This script will detect Python installation, create venv and install - all necessary packages from `requirements.txt` needed by Pype to be - included during application freeze on Windows. + This script will detect Python installation, and build OpenPype to `build` + directory using existing virtual environment created by Poetry (or + by running `/tools/create_venv.ps1`). It will then shuffle dependencies in + build folder to optimize for different Python versions (2/3) in Python host. .EXAMPLE @@ -75,14 +76,11 @@ function Install-Poetry() { $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -93,28 +91,28 @@ Write-Host $art -ForegroundColor DarkGreen $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName +$openpype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +Set-Location -Path $openpype_root -$version_file = Get-Content -Path "$($pype_root)\pype\version.py" +$version_file = Get-Content -Path "$($openpype_root)\pype\version.py" $result = [regex]::Matches($version_file, '__version__ = "(?\d+\.\d+.\d+.*)"') -$pype_version = $result[0].Groups['version'].Value -if (-not $pype_version) { +$openpype_version = $result[0].Groups['version'].Value +if (-not $openpype_version) { Write-Host "!!! " -ForegroundColor yellow -NoNewline - Write-Host "Cannot determine Pype version." + Write-Host "Cannot determine OpenPype version." Exit-WithCode 1 } # Create build directory if not exist -if (-not (Test-Path -PathType Container -Path "$($pype_root)\build")) { - New-Item -ItemType Directory -Force -Path "$($pype_root)\build" +if (-not (Test-Path -PathType Container -Path "$($openpype_root)\build")) { + New-Item -ItemType Directory -Force -Path "$($openpype_root)\build" } Write-Host "--- " -NoNewline -ForegroundColor yellow Write-Host "Cleaning build directory ..." try { - Remove-Item -Recurse -Force "$($pype_root)\build\*" + Remove-Item -Recurse -Force "$($openpype_root)\build\*" } catch { Write-Host "!!! " -NoNewline -ForegroundColor Red @@ -124,8 +122,8 @@ catch { } Write-Host ">>> " -NoNewline -ForegroundColor green -Write-Host "Building Pype [ " -NoNewline -ForegroundColor white -Write-host $pype_version -NoNewline -ForegroundColor green +Write-Host "Building OpenPype [ " -NoNewline -ForegroundColor white +Write-host $openpype_version -NoNewline -ForegroundColor green Write-Host " ] ..." -ForegroundColor white Write-Host ">>> " -NoNewline -ForegroundColor green @@ -167,31 +165,31 @@ if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin") Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Cleaning cache files ... " -NoNewline -Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force -Get-ChildItem $pype_root -Filter "*.pyo" -Force -Recurse | Remove-Item -Force -Get-ChildItem $pype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse +Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force +Get-ChildItem $openpype_root -Filter "*.pyo" -Force -Recurse | Remove-Item -Force +Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse Write-Host "OK" -ForegroundColor green Write-Host ">>> " -NoNewline -ForegroundColor green -Write-Host "Building Pype ..." +Write-Host "Building OpenPype ..." $out = & poetry run python setup.py build 2>&1 if ($LASTEXITCODE -ne 0) { - Set-Content -Path "$($pype_root)\build\build.log" -Value $out + Set-Content -Path "$($openpype_root)\build\build.log" -Value $out Write-Host "!!! " -NoNewLine -ForegroundColor Red Write-Host "Build failed. Check the log: " -NoNewline Write-Host ".\build\build.log" -ForegroundColor Yellow Exit-WithCode $LASTEXITCODE } -Set-Content -Path "$($pype_root)\build\build.log" -Value $out -& poetry run python "$($pype_root)\tools\build_dependencies.py" +Set-Content -Path "$($openpype_root)\build\build.log" -Value $out +& poetry run python "$($openpype_root)\tools\build_dependencies.py" Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "restoring current directory" Set-Location -Path $current_dir Write-Host "*** " -NoNewline -ForegroundColor Cyan -Write-Host "All done. You will find Pype and build log in " -NoNewLine +Write-Host "All done. You will find OpenPype and build log in " -NoNewLine Write-Host "'.\build'" -NoNewline -ForegroundColor Green Write-Host " directory." diff --git a/tools/build.sh b/tools/build.sh index 27d10f1d4d..b95e2969c4 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,13 +5,12 @@ art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -93,7 +92,7 @@ detect_python () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$openpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -136,16 +135,16 @@ main () { detect_python || return 1 # Directories - pype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})")) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})")) + pushd "$openpype_root" > /dev/null || return > /dev/null - version_command="import os;exec(open(os.path.join('$pype_root', 'pype', 'version.py')).read());print(__version__);" - pype_version="$(python3 <<< ${version_command})" + version_command="import os;exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read());print(__version__);" + openpype_version="$(python3 <<< ${version_command})" echo -e "${BIYellow}---${RST} Cleaning build directory ..." - rm -rf "$pype_root/build" && mkdir "$pype_root/build" > /dev/null + rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null - echo -e "${BIGreen}>>>${RST} Building Pype ${BIWhite}[${RST} ${BIGreen}$pype_version${RST} ${BIWhite}]${RST}" + echo -e "${BIGreen}>>>${RST} Building OpenPype ${BIWhite}[${RST} ${BIGreen}$openpype_version${RST} ${BIWhite}]${RST}" echo -e "${BIGreen}>>>${RST} Cleaning cache files ..." clean_pyc @@ -159,11 +158,11 @@ main () { fi echo -e "${BIGreen}>>>${RST} Building ..." - poetry run python3 "$pype_root/setup.py" build > "$pype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; } - poetry run python3 "$pype_root/tools/build_dependencies.py" + poetry run python3 "$openpype_root/setup.py" build > "$openpype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; } + poetry run python3 "$openpype_root/tools/build_dependencies.py" - echo -e "${BICyan}>>>${RST} All done. You will find Pype and build log in \c" - echo -e "${BIWhite}$pype_root/build${RST} directory." + echo -e "${BICyan}>>>${RST} All done. You will find OpenPype and build log in \c" + echo -e "${BIWhite}$openpype_root/build${RST} directory." } main diff --git a/tools/build_dependencies.py b/tools/build_dependencies.py index ada786e96f..e49e930a70 100644 --- a/tools/build_dependencies.py +++ b/tools/build_dependencies.py @@ -101,8 +101,8 @@ for d in libs_dir.iterdir(): to_delete.append(d) _print(f"found {d}", 3) -# add pype and igniter in libs too -to_delete.append(libs_dir / "pype") +# add openpype and igniter in libs too +to_delete.append(libs_dir / "openpype") to_delete.append(libs_dir / "igniter") # delete duplicates diff --git a/tools/create_env.ps1 b/tools/create_env.ps1 index ccc0cab2e7..44e1799be8 100644 --- a/tools/create_env.ps1 +++ b/tools/create_env.ps1 @@ -1,11 +1,11 @@ <# .SYNOPSIS - Helper script create virtual env. + Helper script create virtual environment using Poetry. .DESCRIPTION - This script will detect Python installation, create venv and install - all necessary packages from `requirements.txt` needed by Pype to be - included during application freeze on Windows. + This script will detect Python installation, create venv with Poetry + and install all necessary packages from `poetry.lock` or `pyproject.toml` + needed by OpenPype to be included during application freeze on Windows. .EXAMPLE @@ -82,20 +82,17 @@ print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1])) $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName +$openpype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +Set-Location -Path $openpype_root $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -104,18 +101,18 @@ Write-Host $art -ForegroundColor DarkGreen # Enable if PS 7.x is needed. # Show-PSWarning -$version_file = Get-Content -Path "$($pype_root)\pype\version.py" +$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py" $result = [regex]::Matches($version_file, '__version__ = "(?\d+\.\d+.\d+.*)"') -$pype_version = $result[0].Groups['version'].Value -if (-not $pype_version) { +$openpype_version = $result[0].Groups['version'].Value +if (-not $openpype_version) { Write-Host "!!! " -ForegroundColor yellow -NoNewline - Write-Host "Cannot determine Pype version." + Write-Host "Cannot determine OpenPype version." Set-Location -Path $current_dir Exit-WithCode 1 } Write-Host ">>> " -NoNewline -ForegroundColor Green -Write-Host "Found Pype version " -NoNewline -Write-Host "[ $($pype_version) ]" -ForegroundColor Green +Write-Host "Found OpenPype version " -NoNewline +Write-Host "[ $($openpype_version) ]" -ForegroundColor Green Test-Python @@ -129,7 +126,7 @@ if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin") Write-Host "OK" -ForegroundColor Green } -if (-not (Test-Path -PathType Leaf -Path "$($pype_root)\poetry.lock")) { +if (-not (Test-Path -PathType Leaf -Path "$($openpype_root)\poetry.lock")) { Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Installing virtual environment and creating lock." } else { @@ -145,4 +142,4 @@ if ($LASTEXITCODE -ne 0) { } Set-Location -Path $current_dir Write-Host ">>> " -NoNewline -ForegroundColor green -Write-Host "Virtual environment created. " \ No newline at end of file +Write-Host "Virtual environment created." diff --git a/tools/create_env.sh b/tools/create_env.sh index 52bc79ca83..6ca0731963 100755 --- a/tools/create_env.sh +++ b/tools/create_env.sh @@ -1,19 +1,17 @@ #!/usr/bin/env bash -# This script will detect Python installation, and create virtual environment -# for Pype to run or build. - +# This script will detect Python installation, create venv with Poetry +# and install all necessary packages from `poetry.lock` or `pyproject.toml` +# needed by OpenPype to be included during application freeze on unix. art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -117,7 +115,7 @@ install_poetry () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$openpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -144,8 +142,8 @@ main () { detect_python || return 1 # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" > /dev/null || return > /dev/null echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c" if [ -f "$HOME/.poetry/bin/poetry" ]; then @@ -156,7 +154,7 @@ main () { install_poetry || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; } fi - if [ -f "$pype_root/poetry.lock" ]; then + if [ -f "$openpype_root/poetry.lock" ]; then echo -e "${BIGreen}>>>${RST} Updating dependencies ..." else echo -e "${BIGreen}>>>${RST} Installing dependencies ..." diff --git a/tools/create_zip.ps1 b/tools/create_zip.ps1 index 900bc0d523..d18806c40b 100644 --- a/tools/create_zip.ps1 +++ b/tools/create_zip.ps1 @@ -1,11 +1,12 @@ <# .SYNOPSIS - Helper script create distributable Pype zip. + Helper script create distributable OpenPype zip. .DESCRIPTION - This script will detect Python installation, create venv and install - all necessary packages from `requirements.txt` needed by Pype to be - included during application freeze on Windows. + This script will detect Python installation and run OpenPype to create + zip. It needs mongodb running. I will create zip from current source code + version and copy it top `%LOCALAPPDATA%/pypeclub/pype` if `--path` or `-p` + argument is not used. .EXAMPLE @@ -35,19 +36,16 @@ function Show-PSWarning() { $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +$openpype_root = (Get-Item $script_dir).parent.FullName +Set-Location -Path $openpype_root $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -56,12 +54,12 @@ Write-Host $art -ForegroundColor DarkGreen # Enable if PS 7.x is needed. # Show-PSWarning -$version_file = Get-Content -Path "$($pype_root)\pype\version.py" +$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py" $result = [regex]::Matches($version_file, '__version__ = "(?\d+\.\d+.\d+.*)"') -$pype_version = $result[0].Groups['version'].Value -if (-not $pype_version) { +$openpype_version = $result[0].Groups['version'].Value +if (-not $openpype_version) { Write-Host "!!! " -ForegroundColor yellow -NoNewline - Write-Host "Cannot determine Pype version." + Write-Host "Cannot determine OpenPype version." Exit-WithCode 1 } @@ -95,5 +93,5 @@ Write-Host "Generating zip from current sources ..." Write-Host "... " -NoNewline -ForegroundColor Magenta Write-Host "arguments: " -NoNewline -ForegroundColor Gray Write-Host $ARGS -ForegroundColor White -& poetry run python "$($pype_root)\start.py" generate-zip $ARGS +& poetry run python "$($openpype_root)\start.py" generate-zip $ARGS Set-Location -Path $current_dir \ No newline at end of file diff --git a/tools/create_zip.sh b/tools/create_zip.sh index 839b1c4827..6e7f792f1d 100755 --- a/tools/create_zip.sh +++ b/tools/create_zip.sh @@ -1,17 +1,18 @@ #!/usr/bin/env bash -# Helper script to create Pype zip. - +# This script will detect Python installation and run OpenPype to create +# zip. It needs mongodb running. I will create zip from current source code +# version and copy it top `~/.local/share/pype` if `--path` or `-p` +# argument is not used. art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -91,7 +92,7 @@ detect_python () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$openpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -118,11 +119,11 @@ main () { detect_python || return 1 # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" > /dev/null || return > /dev/null echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..." - poetry run python3 "$pype_root/start.py" generate-zip "$@" + poetry run python3 "$openpype_root/start.py" generate-zip "$@" } main "$@" diff --git a/tools/make_docs.ps1 b/tools/make_docs.ps1 index 8ce991d5bb..aa526bbdc9 100644 --- a/tools/make_docs.ps1 +++ b/tools/make_docs.ps1 @@ -1,9 +1,9 @@ <# .SYNOPSIS - Helper script to update Pype Sphinx sources. + Helper script to update OpenPype Sphinx sources. .DESCRIPTION - This script will run apidoc over Pype sources and generate new source rst + This script will run apidoc over OpenPype sources and generate new source rst files for documentation. Then it will run build_sphinx to create test html documentation build. @@ -15,33 +15,31 @@ PS> .\make_docs.ps1 $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +$openpype_root = (Get-Item $script_dir).parent.FullName +Set-Location -Path $openpype_root $art = @" - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ Write-Host $art -ForegroundColor DarkGreen Write-Host "This will not overwrite existing source rst files, only scan and add new." -Set-Location -Path $pype_root +Set-Location -Path $openpype_root Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Running apidoc ..." -& poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" igniter -& poetry run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" pype vendor, pype\vendor +& poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" igniter +& poetry run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" openpype vendor, openpype\vendor Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Building html ..." -& poetry run python "$($pype_root)\setup.py" build_sphinx +& poetry run python "$($openpype_root)\setup.py" build_sphinx Set-Location -Path $current_dir diff --git a/tools/make_docs.sh b/tools/make_docs.sh index ed5c72b055..2ac12d3d95 100755 --- a/tools/make_docs.sh +++ b/tools/make_docs.sh @@ -1,18 +1,17 @@ #!/usr/bin/env bash -# Make Pype documentation - +# This script will run apidoc over OpenPype sources and generate new source rst +# files for documentation. Then it will run build_sphinx to create test html +# documentation build. art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -71,15 +70,15 @@ main () { echo -e "${RST}" # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" > /dev/null || return > /dev/null echo -e "${BIGreen}>>>${RST} Running apidoc ..." - poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter - poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" pype vendor, pype\vendor + poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" igniter + poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" openpype vendor, openpype\vendor echo -e "${BIGreen}>>>${RST} Building html ..." - poetry run python3 "$pype_root/setup.py" build_sphinx + poetry run python3 "$openpype_root/setup.py" build_sphinx } main diff --git a/tools/run_mongo.ps1 b/tools/run_mongo.ps1 index a72c8b1210..da5f4aaa26 100644 --- a/tools/run_mongo.ps1 +++ b/tools/run_mongo.ps1 @@ -13,14 +13,11 @@ PS> .\run_mongo.ps1 $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -80,13 +77,13 @@ function Find-Mongo { } $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName +$openpype_root = (Get-Item $script_dir).parent.FullName # mongodb port $port = 2707 # path to database -$dbpath = (Get-Item $pype_root).parent.FullName + "\mongo_db_data" +$dbpath = (Get-Item $openpype_root).parent.FullName + "\mongo_db_data" Find-Mongo $mongo = Get-Command "mongod" | Select-Object -ExpandProperty Definition diff --git a/tools/run_mongo.sh b/tools/run_mongo.sh index 209e80ac5b..1c788abcaf 100755 --- a/tools/run_mongo.sh +++ b/tools/run_mongo.sh @@ -6,13 +6,12 @@ art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -72,11 +71,11 @@ main () { echo -e "${RST}" # Directories - pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))) + pushd "$openpype_root" > /dev/null || return > /dev/null mongo_port=2707 - dbpath="$(dirname $pype_root)/mongo_db_data" + dbpath="$(dirname $openpype_root)/mongo_db_data" echo -e "${BIGreen}>>>${RST} Running mongodb ..." mongod --dbpath "$dbpath" --port $mongo_port diff --git a/tools/run_settings.ps1 b/tools/run_settings.ps1 index acecae0bb6..3f99de4b4e 100644 --- a/tools/run_settings.ps1 +++ b/tools/run_settings.ps1 @@ -1,9 +1,9 @@ <# .SYNOPSIS - Helper script to Pype Settings UI + Helper script to OpenPype Settings UI .DESCRIPTION - This script will run Pype and open Settings UI. + This script will run OpenPype and open Settings UI. .EXAMPLE @@ -13,7 +13,7 @@ PS> .\run_settings.ps1 $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root -& poetry run python "$($pype_root)\start.py" settings --dev +$openpype_root = (Get-Item $script_dir).parent.FullName +Set-Location -Path $openpype_root +& poetry run python "$($openpype_root)\start.py" settings --dev Set-Location -Path $current_dir \ No newline at end of file diff --git a/tools/run_settings.sh b/tools/run_settings.sh index 99148456c0..0c8a951d7c 100755 --- a/tools/run_settings.sh +++ b/tools/run_settings.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash -# Run Pype Settings GUI +# Run OpenPype Settings GUI art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -91,7 +90,7 @@ detect_python () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$oepnpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -118,11 +117,11 @@ main () { detect_python || return 1 # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" > /dev/null || return > /dev/null echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..." - poetry run python3 "$pype_root/start.py" settings --dev + poetry run python3 "$openpype_root/start.py" settings --dev } main diff --git a/tools/run_tests.ps1 b/tools/run_tests.ps1 index 0f66c0079f..5070591c02 100644 --- a/tools/run_tests.ps1 +++ b/tools/run_tests.ps1 @@ -1,11 +1,9 @@ <# .SYNOPSIS - Helper script to build Pype. + Helper script to run tests for OpenPype. .DESCRIPTION - This script will detect Python installation, create venv and install - all necessary packages from `requirements.txt` needed by Pype to be - included during application freeze on Windows. + This will use virtual environment and pytest to run test for OpenPype. .EXAMPLE @@ -34,14 +32,11 @@ function Show-PSWarning() { $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -52,22 +47,22 @@ Write-Host $art -ForegroundColor DarkGreen $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName +$openpype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +Set-Location -Path $openpype_root -$version_file = Get-Content -Path "$($pype_root)\pype\version.py" +$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py" $result = [regex]::Matches($version_file, '__version__ = "(?\d+\.\d+.\d+.*)"') -$pype_version = $result[0].Groups['version'].Value -if (-not $pype_version) { +$openpype_version = $result[0].Groups['version'].Value +if (-not $openpype_version) { Write-Host "!!! " -ForegroundColor yellow -NoNewline - Write-Host "Cannot determine Pype version." + Write-Host "Cannot determine OpenPype version." Exit-WithCode 1 } Write-Host ">>> " -NoNewline -ForegroundColor green -Write-Host "Building Pype [ " -NoNewline -ForegroundColor white -Write-host $pype_version -NoNewline -ForegroundColor green +Write-Host "Building OpenPype [ " -NoNewline -ForegroundColor white +Write-host $openpype_version -NoNewline -ForegroundColor green Write-Host " ] ..." -ForegroundColor white Write-Host ">>> " -NoNewline -ForegroundColor green @@ -97,15 +92,15 @@ Write-Host "OK [ $p ]" -ForegroundColor green Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Cleaning cache files ... " -NoNewline -Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force -Get-ChildItem $pype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse +Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force +Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse Write-Host "OK" -ForegroundColor green Write-Host ">>> " -NoNewline -ForegroundColor green -Write-Host "Testing Pype ..." +Write-Host "Testing OpenPype ..." $original_pythonpath = $env:PYTHONPATH -$env:PYTHONPATH="$($pype_root);$($env:PYTHONPATH)" -& poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($pype_root)/tests" +$env:PYTHONPATH="$($openpype_root);$($env:PYTHONPATH)" +& poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($openpype_root)/tests" $env:PYTHONPATH = $original_pythonpath Write-Host ">>> " -NoNewline -ForegroundColor green diff --git a/tools/run_tests.sh b/tools/run_tests.sh index df001dce97..0af052ca01 100755 --- a/tools/run_tests.sh +++ b/tools/run_tests.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash -# Run tests for Pype - +# Run tests for OpenPype +# This will use virtual environment and pytest to run test for OpenPype. art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -87,7 +86,7 @@ detect_python () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$openpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -114,13 +113,13 @@ main () { detect_python || return 1 # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" || return > /dev/null - echo -e "${BIGreen}>>>${RST} Testing Pype ..." + echo -e "${BIGreen}>>>${RST} Testing OpenPype ..." original_pythonpath=$PYTHONPATH - export PYTHONPATH="$pype_root:$PYTHONPATH" - poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests" + export PYTHONPATH="$openpype_root:$PYTHONPATH" + poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$openpype_root/tests" PYTHONPATH=$original_pythonpath } diff --git a/tools/run_tray.ps1 b/tools/run_tray.ps1 index 9584c05925..9485584c6f 100644 --- a/tools/run_tray.ps1 +++ b/tools/run_tray.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - Helper script Pype Tray. + Helper script OpenPype Tray. .DESCRIPTION @@ -12,8 +12,8 @@ PS> .\run_tray.ps1 #> $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +$openpype_root = (Get-Item $script_dir).parent.FullName +Set-Location -Path $openpype_root -& poetry run python "$($pype_root)\start.py" tray --debug +& poetry run python "$($openpype_root)\start.py" tray --debug Set-Location -Path $current_dir \ No newline at end of file diff --git a/tools/run_tray.sh b/tools/run_tray.sh index 3c63d0babe..8174f7e38a 100755 --- a/tools/run_tray.sh +++ b/tools/run_tray.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash -# Run Pype Tray +# Run OpenPype Tray art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io EOF } @@ -92,7 +91,7 @@ detect_python () { ############################################################################### clean_pyc () { local path - path=$pype_root + path=$openpype_root echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c" find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete echo -e "${BIGreen}DONE${RST}" @@ -119,11 +118,11 @@ main () { detect_python || return 1 # Directories - pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) - pushd "$pype_root" > /dev/null || return > /dev/null + openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) + pushd "$openpype_root" > /dev/null || return > /dev/null - echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..." - poetry run python3 "$pype_root/start.py" tray --debug + echo -e "${BIGreen}>>>${RST} Running OpenPype Tray with debug option ..." + poetry run python3 "$openpype_root/start.py" tray --debug } main \ No newline at end of file diff --git a/tools/update_submodules.ps1 b/tools/update_submodules.ps1 index ca29c7ecc4..d0f93d9f7e 100644 --- a/tools/update_submodules.ps1 +++ b/tools/update_submodules.ps1 @@ -1,26 +1,20 @@ <# .SYNOPSIS - Helper script to run mongodb. - -.DESCRIPTION - This script will detect mongodb, add it to the PATH and launch it on specified port and db location. + Helper script to update submodules. .EXAMPLE -PS> .\run_mongo.ps1 +PS> .\update_submodules.ps1 #> $art = @" - - ____________ - /\ ___ \ - \ \ \/_\ \ - \ \ _____/ ______ ___ ___ ___ - \ \ \___/ /\ \ \ \\ \\ \ - \ \____\ \ \_____\ \__\\__\\__\ - \/____/ \/_____/ . PYPE Club . +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. + https://openpype.io "@ @@ -37,9 +31,9 @@ function Exit-WithCode($exitcode) { $current_dir = Get-Location $script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent -$pype_root = (Get-Item $script_dir).parent.FullName +$openpype_root = (Get-Item $script_dir).parent.FullName -Set-Location -Path $pype_root +Set-Location -Path $openpype_root git submodule update --recursive --remote diff --git a/tools/update_submodules.sh b/tools/update_submodules.sh index 35d943dea5..465827bfbb 100644 --- a/tools/update_submodules.sh +++ b/tools/update_submodules.sh @@ -1,17 +1,15 @@ #!/usr/bin/env bash -# Run Pype Tray +# Run OpenPype Tray art () { cat <<-EOF - ____________ - /\\ ___ \\ - \\ \\ \\/_\\ \\ - \\ \\ _____/ ______ ___ ___ ___ - \\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\ - \\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\ - \\/____/ \\/_____/ . PYPE Club . + +▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀ +▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░ +▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄ + .---= [ by Pype Club ] =---. EOF } From eb829e2ed386c6ff8721b2424696e8bd80a58c4f Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Thu, 1 Apr 2021 16:51:44 +0200 Subject: [PATCH 7/8] rename done in igniter --- igniter/bootstrap_repos.py | 416 +++++++++++++++++++------------------ igniter/install_dialog.py | 71 +++---- igniter/install_thread.py | 74 +++---- igniter/terminal_splash.py | 4 +- igniter/tools.py | 22 +- igniter/user_settings.py | 21 +- repos/avalon-core | 2 +- setup.py | 4 +- start.py | 216 +++++++++---------- 9 files changed, 422 insertions(+), 408 deletions(-) diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py index 58d59afe88..29fc26173e 100644 --- a/igniter/bootstrap_repos.py +++ b/igniter/bootstrap_repos.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Bootstrap Pype repositories.""" +"""Bootstrap OpenPype repositories.""" import functools import logging as log import os @@ -14,8 +14,8 @@ from zipfile import ZipFile, BadZipFile from appdirs import user_data_dir from speedcopy import copyfile -from .user_settings import PypeSettingsRegistry -from .tools import get_pype_path_from_db +from .user_settings import OpenPypeSettingsRegistry +from .tools import get_openpype_path_from_db LOG_INFO = 0 @@ -24,8 +24,8 @@ LOG_ERROR = 3 @functools.total_ordering -class PypeVersion: - """Class for storing information about Pype version. +class OpenPypeVersion: + """Class for storing information about OpenPype version. Attributes: major (int): [1].2.3-client-variant @@ -33,7 +33,7 @@ class PypeVersion: subversion (int): 1.2.[3]-client-variant client (str): 1.2.3-[client]-variant variant (str): 1.2.3-client-[variant] - path (str): path to Pype + path (str): path to OpenPype """ major = 0 @@ -191,37 +191,37 @@ class PypeVersion: @staticmethod def version_in_str(string: str) -> Tuple: - """Find Pype version in given string. + """Find OpenPype version in given string. Args: string (str): string to search. Returns: - tuple: True/False and PypeVersion if found. + tuple: True/False and OpenPypeVersion if found. """ try: - result = PypeVersion._decompose_version(string) + result = OpenPypeVersion._decompose_version(string) except ValueError: return False, None - return True, PypeVersion(major=result[0], - minor=result[1], - subversion=result[2], - variant=result[3], - client=result[4]) + return True, OpenPypeVersion(major=result[0], + minor=result[1], + subversion=result[2], + variant=result[3], + client=result[4]) class BootstrapRepos: - """Class for bootstrapping local Pype installation. + """Class for bootstrapping local OpenPype installation. Attributes: - data_dir (Path): local Pype installation directory. + data_dir (Path): local OpenPype installation directory. live_repo_dir (Path): path to repos directory if running live, otherwise `None`. - registry (PypeSettingsRegistry): Pype registry object. + registry (OpenPypeSettingsRegistry): OpenPype registry object. zip_filter (list): List of files to exclude from zip - pype_filter (list): list of top level directories not to include in - zip in Pype repository. + openpype_filter (list): list of top level directories not to + include in zip in OpenPype repository. """ @@ -236,12 +236,12 @@ class BootstrapRepos: """ # vendor and app used to construct user data dir self._vendor = "pypeclub" - self._app = "pype" + self._app = "openpype" self._log = log.getLogger(str(__class__)) self.data_dir = Path(user_data_dir(self._app, self._vendor)) - self.registry = PypeSettingsRegistry() + self.registry = OpenPypeSettingsRegistry() self.zip_filter = [".pyc", "__pycache__"] - self.pype_filter = [ + self.openpype_filter = [ "build", "docs", "tests", "repos", "tools", "venv" ] self._message = message @@ -262,11 +262,11 @@ class BootstrapRepos: @staticmethod def get_version_path_from_list(version: str, version_list: list) -> Path: - """Get path for specific version in list of Pype versions. + """Get path for specific version in list of OpenPype versions. Args: version (str): Version string to look for (1.2.4-staging) - version_list (list of PypeVersion): list of version to search. + version_list (list of OpenPypeVersion): list of version to search. Returns: Path: Path to given version. @@ -278,31 +278,32 @@ class BootstrapRepos: @staticmethod def get_local_live_version() -> str: - """Get version of local Pype.""" + """Get version of local OpenPype.""" version = {} - path = Path(os.path.dirname(__file__)).parent / "pype" / "version.py" + path = Path(os.path.dirname(__file__)).parent / "openpype" / "version.py" with open(path, "r") as fp: exec(fp.read(), version) return version["__version__"] @staticmethod def get_version(repo_dir: Path) -> Union[str, None]: - """Get version of Pype in given directory. + """Get version of OpenPype in given directory. - Note: in frozen Pype installed in user data dir, this must point - one level deeper as it is `pype-version-v3.0.0/pype/pype/version.py` + Note: in frozen OpenPype installed in user data dir, this must point + one level deeper as it is: + `openpype-version-v3.0.0/openpype/version.py` Args: - repo_dir (Path): Path to Pype repo. + repo_dir (Path): Path to OpenPype repo. Returns: str: version string. - None: if Pype is not found. + None: if OpenPype is not found. """ # try to find version - version_file = Path(repo_dir) / "pype" / "version.py" + version_file = Path(repo_dir) / "openpype" / "version.py" if not version_file.exists(): return None @@ -313,22 +314,22 @@ class BootstrapRepos: return version['__version__'] def create_version_from_live_code( - self, repo_dir: Path = None) -> Union[PypeVersion, None]: - """Copy zip created from Pype repositories to user data dir. + self, repo_dir: Path = None) -> Union[OpenPypeVersion, None]: + """Copy zip created from OpenPype repositories to user data dir. - This detect Pype version either in local "live" Pype repository - or in user provided path. Then it will zip it in temporary directory - and finally it will move it to destination which is user data - directory. Existing files will be replaced. + This detect OpenPype version either in local "live" OpenPype + repository or in user provided path. Then it will zip it in temporary + directory and finally it will move it to destination which is user + data directory. Existing files will be replaced. Args: - repo_dir (Path, optional): Path to Pype repository. + repo_dir (Path, optional): Path to OpenPype repository. Returns: Path: path of installed repository file. """ - # if repo dir is not set, we detect local "live" Pype repository + # if repo dir is not set, we detect local "live" OpenPype repository # version and use it as a source. Otherwise repo_dir is user # entered location. if not repo_dir: @@ -338,7 +339,7 @@ class BootstrapRepos: version = self.get_version(repo_dir) if not version: - self._print("Pype not found.", LOG_ERROR) + self._print("OpenPype not found.", LOG_ERROR) return # create destination directory @@ -348,20 +349,20 @@ class BootstrapRepos: # create zip inside temporary directory. with tempfile.TemporaryDirectory() as temp_dir: temp_zip = \ - Path(temp_dir) / f"pype-v{version}.zip" + Path(temp_dir) / f"openpype-v{version}.zip" self._print(f"creating zip: {temp_zip}") - self._create_pype_zip(temp_zip, repo_dir) + self._create_openpype_zip(temp_zip, repo_dir) if not os.path.exists(temp_zip): self._print("make archive failed.", LOG_ERROR) return None destination = self._move_zip_to_data_dir(temp_zip) - return PypeVersion(version=version, path=destination) + return OpenPypeVersion(version=version, path=destination) def _move_zip_to_data_dir(self, zip_file) -> Union[None, Path]: - """Move zip with Pype version to user data directory. + """Move zip with OpenPype version to user data directory. Args: zip_file (Path): Path to zip file. @@ -404,16 +405,16 @@ class BootstrapRepos: result.append(item) return result - def create_version_from_frozen_code(self) -> Union[None, PypeVersion]: - """Create Pype version from *frozen* code distributed by installer. + def create_version_from_frozen_code(self) -> Union[None, OpenPypeVersion]: + """Create OpenPype version from *frozen* code distributed by installer. - This should be real edge case for those wanting to try out Pype + This should be real edge case for those wanting to try out OpenPype without setting up whole infrastructure but is strongly discouraged in studio setup as this use local version independent of others that can be out of date. Returns: - :class:`PypeVersion` zip file to be installed. + :class:`OpenPypeVersion` zip file to be installed. """ frozen_root = Path(sys.executable).parent @@ -421,24 +422,24 @@ class BootstrapRepos: repo_list = self._filter_dir( repo_dir, self.zip_filter) - # from frozen code we need igniter, pype, schema vendor - pype_list = self._filter_dir( - frozen_root / "pype", self.zip_filter) - pype_list += self._filter_dir( + # from frozen code we need igniter, openpype, schema vendor + openpype_list = self._filter_dir( + frozen_root / "openpype", self.zip_filter) + openpype_list += self._filter_dir( frozen_root / "igniter", self.zip_filter) - pype_list += self._filter_dir( + openpype_list += self._filter_dir( frozen_root / "schema", self.zip_filter) - pype_list += self._filter_dir( + openpype_list += self._filter_dir( frozen_root / "vendor", self.zip_filter) - pype_list.append(frozen_root / "README.md") - pype_list.append(frozen_root / "LICENSE") + openpype_list.append(frozen_root / "README.md") + openpype_list.append(frozen_root / "LICENSE") version = self.get_version(frozen_root) # create zip inside temporary directory. with tempfile.TemporaryDirectory() as temp_dir: temp_zip = \ - Path(temp_dir) / f"pype-v{version}.zip" + Path(temp_dir) / f"openpype-v{version}.zip" self._print(f"creating zip: {temp_zip}") with ZipFile(temp_zip, "w") as zip_file: @@ -453,43 +454,44 @@ class BootstrapRepos: arc_name = file.relative_to(repo_dir) zip_file.write(file, arc_name) - pype_inc = 48.0 / float(len(pype_list)) + openpype_inc = 48.0 / float(len(openpype_list)) file: Path - for file in pype_list: - progress += pype_inc + for file in openpype_list: + progress += openpype_inc self._progress_callback(int(progress)) arc_name = file.relative_to(frozen_root.parent) # we need to replace first part of path which starts with - # something like `exe.win/linux....` with `pype` as this - # is expected by Pype in zip archive. - arc_name = Path("pype").joinpath(*arc_name.parts[1:]) + # something like `exe.win/linux....` with `openpype` as this + # is expected by OpenPype in zip archive. + arc_name = Path("openpype").joinpath(*arc_name.parts[1:]) zip_file.write(file, arc_name) destination = self._move_zip_to_data_dir(temp_zip) - return PypeVersion(version=version, path=destination) + return OpenPypeVersion(version=version, path=destination) - def _create_pype_zip( + def _create_poenpype_zip( self, zip_path: Path, include_dir: Path, - include_pype: bool = True) -> None: - """Pack repositories and Pype into zip. + include_openpype: bool = True) -> None: + """Pack repositories and OpenPype into zip. We are using :mod:`zipfile` instead :meth:`shutil.make_archive` because we need to decide what file and directories to include in zip and what not. They are determined by :attr:`zip_filter` on file level - and :attr:`pype_filter` on top level directory in Pype repository. + and :attr:`openpype_filter` on top level directory in OpenPype + repository. Args: zip_path (str): path to zip file. include_dir (Path): repo directories to include. - include_pype (bool): add Pype module itself. + include_openpype (bool): add OpenPype module itself. """ include_dir = include_dir.resolve() - pype_list = [] + openpype_list = [] # get filtered list of files in repositories (repos directory) repo_list = self._filter_dir(include_dir, self.zip_filter) # count them @@ -497,13 +499,13 @@ class BootstrapRepos: # there must be some files, otherwise `include_dir` path is wrong assert repo_files != 0, f"No repositories to include in {include_dir}" - pype_inc = 0 - if include_pype: + openpype_inc = 0 + if include_openpype: # get filtered list of file in Pype repository - pype_list = self._filter_dir(include_dir.parent, self.zip_filter) - pype_files = len(pype_list) + openpype_list = self._filter_dir(include_dir.parent, self.zip_filter) + openpype_files = len(openpype_list) repo_inc = 48.0 / float(repo_files) - pype_inc = 48.0 / float(pype_files) + openpype_inc = 48.0 / float(openpype_files) else: repo_inc = 98.0 / float(repo_files) @@ -518,15 +520,15 @@ class BootstrapRepos: arc_name = file.relative_to(include_dir) zip_file.write(file, arc_name) - # add pype itself - if include_pype: - pype_root = include_dir.parent.resolve() + # add openpype itself + if include_openpype: + openpype_root = include_dir.parent.resolve() # generate list of filtered paths - dir_filter = [pype_root / f for f in self.pype_filter] + dir_filter = [openpype_root / f for f in self.openpype_filter] file: Path - for file in pype_list: - progress += pype_inc + for file in openpype_list: + progress += openpype_inc self._progress_callback(int(progress)) # if file resides in filtered path, skip it @@ -545,7 +547,8 @@ class BootstrapRepos: self._print(f"- processing {processed_path}") zip_file.write(file, - "pype" / file.relative_to(pype_root)) + "openpype" / file.relative_to( + openpype_root)) # test if zip is ok zip_file.testzip() @@ -616,49 +619,49 @@ class BootstrapRepos: os.environ["PYTHONPATH"] = os.pathsep.join(paths) - def find_pype( + def find_openpype( self, - pype_path: Union[Path, str] = None, + openpype_path: Union[Path, str] = None, staging: bool = False, - include_zips: bool = False) -> Union[List[PypeVersion], None]: - """Get ordered dict of detected Pype version. + include_zips: bool = False) -> Union[List[OpenPypeVersion], None]: + """Get ordered dict of detected OpenPype version. - Resolution order for Pype is following: + Resolution order for OpenPype is following: - 1) First we test for ``PYPE_PATH`` environment variable - 2) We try to find ``pypePath`` in registry setting + 1) First we test for ``OPENPYPE_PATH`` environment variable + 2) We try to find ``openPypePath`` in registry setting 3) We use user data directory Args: - pype_path (Path or str, optional): Try to find Pype on the given - path or url. + openpype_path (Path or str, optional): Try to find OpenPype on + the given path or url. staging (bool, optional): Filter only staging version, skip them otherwise. include_zips (bool, optional): If set True it will try to find - Pype in zip files in given directory. + OpenPype in zip files in given directory. Returns: - dict of Path: Dictionary of detected Pype version. + dict of Path: Dictionary of detected OpenPype version. Key is version, value is path to zip file. - None: if Pype is not found. + None: if OpenPype is not found. Todo: - implement git/url support as Pype location, so it would be - possible to enter git url, Pype would check it out and if it is + implement git/url support as OpenPype location, so it would be + possible to enter git url, OpenPype would check it out and if it is ok install it as normal version. """ - if pype_path and not isinstance(pype_path, Path): + if openpype_path and not isinstance(openpype_path, Path): raise NotImplementedError( - ("Finding Pype in non-filesystem locations is" + ("Finding OpenPype in non-filesystem locations is" " not implemented yet.")) dir_to_search = self.data_dir - # if we have pype_path specified, search only there. - if pype_path: - dir_to_search = pype_path + # if we have openpype_path specified, search only there. + if openpype_path: + dir_to_search = openpype_path else: if os.getenv("PYPE_PATH"): if Path(os.getenv("PYPE_PATH")).exists(): @@ -666,7 +669,7 @@ class BootstrapRepos: else: try: registry_dir = Path( - str(self.registry.get_item("pypePath"))) + str(self.registry.get_item("openPypePath"))) if registry_dir.exists(): dir_to_search = registry_dir @@ -674,22 +677,22 @@ class BootstrapRepos: # nothing found in registry, we'll use data dir pass - pype_versions = self.get_pype_versions(dir_to_search, staging) + openpype_versions = self.get_openpype_versions(dir_to_search, staging) # remove zip file version if needed. if not include_zips: - pype_versions = [ - v for v in pype_versions if v.path.suffix != ".zip" + openpype_versions = [ + v for v in openpype_versions if v.path.suffix != ".zip" ] - return pype_versions + return openpype_versions def process_entered_location(self, location: str) -> Union[Path, None]: """Process user entered location string. It decides if location string is mongodb url or path. - If it is mongodb url, it will connect and load ``PYPE_PATH`` from - there and use it as path to Pype. In it is _not_ mongodb url, it + If it is mongodb url, it will connect and load ``OPENPYPE_PATH`` from + there and use it as path to OpenPype. In it is _not_ mongodb url, it is assumed we have a path, this is tested and zip file is produced and installed using :meth:`create_version_from_live_code`. @@ -697,51 +700,52 @@ class BootstrapRepos: location (str): User entered location. Returns: - Path: to Pype zip produced from this location. + Path: to OpenPype zip produced from this location. None: Zipping failed. """ - pype_path = None - # try to get pype path from mongo. + openpype_path = None + # try to get OpenPype path from mongo. if location.startswith("mongodb"): - pype_path = get_pype_path_from_db(location) - if not pype_path: + pype_path = get_openpype_path_from_db(location) + if not openpype_path: self._print("cannot find PYPE_PATH in settings.") return None # if not successful, consider location to be fs path. - if not pype_path: - pype_path = Path(location) + if not openpype_path: + openpype_path = Path(location) # test if this path does exist. - if not pype_path.exists(): - self._print(f"{pype_path} doesn't exists.") + if not openpype_path.exists(): + self._print(f"{openpype_path} doesn't exists.") return None # test if entered path isn't user data dir - if self.data_dir == pype_path: + if self.data_dir == openpype_path: self._print("cannot point to user data dir", LOG_ERROR) return None - # find pype zip files in location. There can be - # either "live" Pype repository, or multiple zip files or even - # multiple pype version directories. This process looks into zip + # find openpype zip files in location. There can be + # either "live" OpenPype repository, or multiple zip files or even + # multiple OpenPype version directories. This process looks into zip # files and directories and tries to parse `version.py` file. - versions = self.find_pype(pype_path, include_zips=True) + versions = self.find_openpype(openpype_path, include_zips=True) if versions: - self._print(f"found Pype in [ {pype_path} ]") + self._print(f"found OpenPype in [ {openpype_path} ]") self._print(f"latest version found is [ {versions[-1]} ]") return self.install_version(versions[-1]) - # if we got here, it means that location is "live" Pype repository. - # we'll create zip from it and move it to user data dir. - live_pype = self.create_version_from_live_code(pype_path) - if not live_pype.path.exists(): - self._print(f"installing zip {live_pype} failed.", LOG_ERROR) + # if we got here, it means that location is "live" + # OpenPype repository. We'll create zip from it and move it to user + # data dir. + live_openpype = self.create_version_from_live_code(openpype_path) + if not live_openpype.path.exists(): + self._print(f"installing zip {live_openpype} failed.", LOG_ERROR) return None # install it - return self.install_version(live_pype) + return self.install_version(live_openpype) def _print(self, message: str, @@ -769,11 +773,11 @@ class BootstrapRepos: return self._log.info(message, exc_info=exc_info) - def extract_pype(self, version: PypeVersion) -> Union[Path, None]: - """Extract zipped Pype version to user data directory. + def extract_openpype(self, version: OpenPypeVersion) -> Union[Path, None]: + """Extract zipped OpenPype version to user data directory. Args: - version (PypeVersion): Version of Pype. + version (OpenPypeVersion): Version of OpenPype. Returns: Path: path to extracted version. @@ -819,40 +823,41 @@ class BootstrapRepos: is_inside = path.resolve().relative_to( self.data_dir) except ValueError: - # if relative path cannot be calculated, Pype version is not + # if relative path cannot be calculated, OpenPype version is not # inside user data dir pass return is_inside def install_version(self, - pype_version: PypeVersion, + openpype_version: OpenPypeVersion, force: bool = False) -> Path: - """Install Pype version to user data directory. + """Install OpenPype version to user data directory. Args: - pype_version (PypeVersion): Pype version to install. + oepnpype_version (OpenPypeVersion): OpenPype version to install. force (bool, optional): Force overwrite existing version. Returns: - Path: Path to installed Pype. + Path: Path to installed OpenPype. Raises: - PypeVersionExists: If not forced and this version already exist + OpenPypeVersionExists: If not forced and this version already exist in user data directory. - PypeVersionInvalid: If version to install is invalid. - PypeVersionIOError: If copying or zipping fail. + OpenPypeVersionInvalid: If version to install is invalid. + OpenPypeVersionIOError: If copying or zipping fail. """ - if self.is_inside_user_data(pype_version.path) and not pype_version.path.is_file(): # noqa - raise PypeVersionExists("Pype already inside user data dir") + if self.is_inside_user_data(openpype_version.path) and not pype_version.path.is_file(): # noqa + raise OpenPypeVersionExists( + "OpenPype already inside user data dir") # determine destination directory name # for zip file strip suffix, in case of dir use whole dir name - if pype_version.path.is_dir(): - dir_name = pype_version.path.name + if openpype_version.path.is_dir(): + dir_name = openpype_version.path.name else: - dir_name = pype_version.path.stem + dir_name = openpype_version.path.stem destination = self.data_dir / dir_name @@ -864,82 +869,83 @@ class BootstrapRepos: self._print( f"cannot remove already existing {destination}", LOG_ERROR, exc_info=True) - raise PypeVersionIOError( + raise OpenPypeVersionIOError( f"cannot remove existing {destination}") from e elif destination.exists() and not force: - raise PypeVersionExists(f"{destination} already exist.") + raise OpenPypeVersionExists(f"{destination} already exist.") else: # create destination parent directories even if they don't exist. destination.mkdir(parents=True) # version is directory - if pype_version.path.is_dir(): + if openpype_version.path.is_dir(): # create zip inside temporary directory. self._print("Creating zip from directory ...") with tempfile.TemporaryDirectory() as temp_dir: temp_zip = \ - Path(temp_dir) / f"pype-v{pype_version}.zip" + Path(temp_dir) / f"openpype-v{openpype_version}.zip" self._print(f"creating zip: {temp_zip}") - self._create_pype_zip(temp_zip, pype_version.path) + self._create_openpype_zip(temp_zip, openpype_version.path) if not os.path.exists(temp_zip): self._print("make archive failed.", LOG_ERROR) - raise PypeVersionIOError("Zip creation failed.") + raise OpenPypeVersionIOError("Zip creation failed.") # set zip as version source - pype_version.path = temp_zip + openpype_version.path = temp_zip - elif pype_version.path.is_file(): + elif openpype_version.path.is_file(): # check if file is zip (by extension) - if pype_version.path.suffix.lower() != ".zip": - raise PypeVersionInvalid("Invalid file format") + if openpype_version.path.suffix.lower() != ".zip": + raise OpenPypeVersionInvalid("Invalid file format") - if not self.is_inside_user_data(pype_version.path): + if not self.is_inside_user_data(openpype_version.path): try: # copy file to destination self._print("Copying zip to destination ...") - _destination_zip = destination.parent / pype_version.path.name + _destination_zip = destination.parent / openpype_version.path.name # noqa: E501 copyfile( - pype_version.path.as_posix(), + openpype_version.path.as_posix(), _destination_zip.as_posix()) except OSError as e: self._print( "cannot copy version to user data directory", LOG_ERROR, exc_info=True) - raise PypeVersionIOError(( - f"can't copy version {pype_version.path.as_posix()} " + raise OpenPypeVersionIOError(( + f"can't copy version {openpype_version.path.as_posix()} " f"to destination {destination.parent.as_posix()}")) from e # extract zip there self._print("extracting zip to destination ...") - with ZipFile(pype_version.path, "r") as zip_ref: + with ZipFile(openpype_version.path, "r") as zip_ref: zip_ref.extractall(destination) return destination - def _is_pype_in_dir(self, - dir_item: Path, - detected_version: PypeVersion) -> bool: - """Test if path item is Pype version matching detected version. + def _is_openpype_in_dir(self, + dir_item: Path, + detected_version: OpenPypeVersion) -> bool: + """Test if path item is OpenPype version matching detected version. If item is directory that might (based on it's name) - contain Pype version, check if it really does contain - Pype and that their versions matches. + contain OpenPype version, check if it really does contain + OpenPype and that their versions matches. Args: dir_item (Path): Directory to test. - detected_version (PypeVersion): Pype version detected from name. + detected_version (OpenPypeVersion): OpenPype version detected + from name. Returns: - True if it is valid Pype version, False otherwise. + True if it is valid OpenPype version, False otherwise. """ try: - # add one 'pype' level as inside dir there should + # add one 'openpype' level as inside dir there should # be many other repositories. version_str = BootstrapRepos.get_version( - dir_item / "pype") - version_check = PypeVersion(version=version_str) + dir_item / "openpype") + version_check = OpenPypeVersion(version=version_str) except ValueError: self._print( f"cannot determine version from {dir_item}", True) @@ -955,21 +961,21 @@ class BootstrapRepos: return False return True - def _is_pype_in_zip(self, - zip_item: Path, - detected_version: PypeVersion) -> bool: - """Test if zip path is Pype version matching detected version. + def _is_openpype_in_zip(self, + zip_item: Path, + detected_version: OpenPypeVersion) -> bool: + """Test if zip path is OpenPype version matching detected version. - Open zip file, look inside and parse version from Pype + Open zip file, look inside and parse version from OpenPype inside it. If there is none, or it is different from version specified in file name, skip it. Args: zip_item (Path): Zip file to test. - detected_version (PypeVersion): Pype version detected from name. + detected_version (OpenPypeVersion): Pype version detected from name. Returns: - True if it is valid Pype version, False otherwise. + True if it is valid OpenPype version, False otherwise. """ # skip non-zip files @@ -979,10 +985,10 @@ class BootstrapRepos: try: with ZipFile(zip_item, "r") as zip_file: with zip_file.open( - "pype/pype/version.py") as version_file: + "openpype/version.py") as version_file: zip_version = {} exec(version_file.read(), zip_version) - version_check = PypeVersion( + version_check = OpenPypeVersion( version=zip_version["__version__"]) version_main = version_check.get_main_version() # noqa: E501 @@ -999,70 +1005,72 @@ class BootstrapRepos: self._print(f"{zip_item} is not a zip file", True) return False except KeyError: - self._print("Zip does not contain Pype", True) + self._print("Zip does not contain OpenPype", True) return False return True - def get_pype_versions(self, pype_dir: Path, staging: bool = False) -> list: - """Get all detected Pype versions in directory. + def get_openpype_versions(self, + openpype_dir: Path, + staging: bool = False) -> list: + """Get all detected OpenPype versions in directory. Args: - pype_dir (Path): Directory to scan. + openpype_dir (Path): Directory to scan. staging (bool, optional): Find staging versions if True. Returns: - list of PypeVersion + list of OpenPypeVersion Throws: ValueError: if invalid path is specified. """ - if not pype_dir.exists() and not pype_dir.is_dir(): + if not openpype_dir.exists() and not openpype_dir.is_dir(): raise ValueError("specified directory is invalid") - _pype_versions = [] + _openpype_versions = [] # iterate over directory in first level and find all that might - # contain Pype. - for item in pype_dir.iterdir(): + # contain OpenPype. + for item in openpype_dir.iterdir(): # if file, strip extension, in case of dir not. name = item.name if item.is_dir() else item.stem - result = PypeVersion.version_in_str(name) + result = OpenPypeVersion.version_in_str(name) if result[0]: - detected_version: PypeVersion + detected_version: OpenPypeVersion detected_version = result[1] - if item.is_dir() and not self._is_pype_in_dir( + if item.is_dir() and not self._is_openpype_in_dir( item, detected_version ): continue - if item.is_file() and not self._is_pype_in_zip( + if item.is_file() and not self._is_openpype_in_zip( item, detected_version ): continue detected_version.path = item if staging and detected_version.is_staging(): - _pype_versions.append(detected_version) + _openpype_versions.append(detected_version) if not staging and not detected_version.is_staging(): - _pype_versions.append(detected_version) + _openpype_versions.append(detected_version) - return sorted(_pype_versions) + return sorted(_openpype_versions) -class PypeVersionExists(Exception): - """Exception for handling existing Pype version.""" +class OpenPypeVersionExists(Exception): + """Exception for handling existing OpenPype version.""" pass -class PypeVersionInvalid(Exception): - """Exception for handling invalid Pype version.""" +class OpenPypeVersionInvalid(Exception): + """Exception for handling invalid OpenPype version.""" pass -class PypeVersionIOError(Exception): - """Exception for handling IO errors in Pype version.""" +class OpenPypeVersionIOError(Exception): + """Exception for handling IO errors in OpenPype version.""" pass diff --git a/igniter/install_dialog.py b/igniter/install_dialog.py index 5fa676fd5b..1e3e52d81f 100644 --- a/igniter/install_dialog.py +++ b/igniter/install_dialog.py @@ -11,9 +11,9 @@ from .install_thread import InstallThread, InstallResult from .tools import ( validate_path_string, validate_mongo_connection, - get_pype_path_from_db + get_openpype_path_from_db ) -from .user_settings import PypeSettingsRegistry +from .user_settings import OpenPypeSettingsRegistry from .version import __version__ @@ -42,7 +42,7 @@ class InstallDialog(QtWidgets.QDialog): def __init__(self, parent=None): super(InstallDialog, self).__init__(parent) - self.registry = PypeSettingsRegistry() + self.registry = OpenPypeSettingsRegistry() self.mongo_url = "" try: @@ -50,7 +50,8 @@ class InstallDialog(QtWidgets.QDialog): except ValueError: pass - self.setWindowTitle(f"Pype Igniter {__version__} - Pype installation") + self.setWindowTitle( + f"OpenPype Igniter {__version__} - OpenPype installation") self._icon_path = os.path.join( os.path.dirname(__file__), 'openpype_icon.png') icon = QtGui.QIcon(self._icon_path) @@ -81,7 +82,7 @@ class InstallDialog(QtWidgets.QDialog): os.path.join( os.path.dirname(__file__), 'RobotoMono-Regular.ttf') ) - self._pype_run_ready = False + self._openpype_run_ready = False self._init_ui() @@ -97,35 +98,35 @@ class InstallDialog(QtWidgets.QDialog): # Main info # -------------------------------------------------------------------- self.main_label = QtWidgets.QLabel( - """Welcome to Pype + """Welcome to OpenPype

- We've detected Pype is not configured yet. But don't worry, + We've detected OpenPype is not configured yet. But don't worry, this is as easy as setting one or two things.

""") self.main_label.setWordWrap(True) self.main_label.setStyleSheet("color: rgb(200, 200, 200);") - # Pype path info + # OpenPype path info # -------------------------------------------------------------------- - self.pype_path_label = QtWidgets.QLabel( - """This is Path to studio location where Pype versions + self.openpype_path_label = QtWidgets.QLabel( + """This is Path to studio location where OpenPype versions are stored. It will be pre-filled if your MongoDB connection is already set and your studio defined this location.

- Leave it empty if you want to install Pype version that comes with - this installation. + Leave it empty if you want to install OpenPype version that + comes with this installation.

- If you want to just try Pype without installing, hit the middle - button that states "run without installation". + If you want to just try OpenPype without installing, hit the + middle button that states "run without installation".

""" ) - self.pype_path_label.setWordWrap(True) - self.pype_path_label.setStyleSheet("color: rgb(150, 150, 150);") + self.openpype_path_label.setWordWrap(True) + self.openpype_path_label.setStyleSheet("color: rgb(150, 150, 150);") # Path/Url box | Select button # -------------------------------------------------------------------- @@ -135,7 +136,7 @@ class InstallDialog(QtWidgets.QDialog): input_layout.setContentsMargins(0, 10, 0, 10) self.user_input = FocusHandlingLineEdit() - self.user_input.setPlaceholderText("Path to Pype versions") + self.user_input.setPlaceholderText("Path to OpenPype versions") self.user_input.textChanged.connect(self._path_changed) self.user_input.setStyleSheet( ("color: rgb(233, 233, 233);" @@ -148,7 +149,7 @@ class InstallDialog(QtWidgets.QDialog): self._btn_select = QtWidgets.QPushButton("Select") self._btn_select.setToolTip( - "Select Pype repository" + "Select OpenPype repository" ) self._btn_select.setStyleSheet( ("color: rgb(64, 64, 64);" @@ -282,13 +283,13 @@ class InstallDialog(QtWidgets.QDialog): # -------------------------------------------------------------------- bottom_widget = QtWidgets.QWidget() bottom_layout = QtWidgets.QHBoxLayout() - pype_logo_label = QtWidgets.QLabel("pype logo") - pype_logo = QtGui.QPixmap(self._icon_path) - # pype_logo.scaled( - # pype_logo_label.width(), - # pype_logo_label.height(), QtCore.Qt.KeepAspectRatio) - pype_logo_label.setPixmap(pype_logo) - pype_logo_label.setContentsMargins(10, 0, 0, 10) + openpype_logo_label = QtWidgets.QLabel("openpype logo") + openpype_logo = QtGui.QPixmap(self._icon_path) + # openpype_logo.scaled( + # openpype_logo_label.width(), + # openpype_logo_label.height(), QtCore.Qt.KeepAspectRatio) + openpype_logo_label.setPixmap(openpype_logo) + openpype_logo_label.setContentsMargins(10, 0, 0, 10) # install button - - - - - - - - - - - - - - - - - - - - - - - - - - - self.install_button = QtWidgets.QPushButton("Install") @@ -298,7 +299,7 @@ class InstallDialog(QtWidgets.QDialog): "padding: 0.5em;") ) self.install_button.setMinimumSize(64, 24) - self.install_button.setToolTip("Install Pype") + self.install_button.setToolTip("Install OpenPype") self.install_button.clicked.connect(self._on_ok_clicked) # run from current button - - - - - - - - - - - - - - - - - - - - - - @@ -325,7 +326,7 @@ class InstallDialog(QtWidgets.QDialog): bottom_layout.setContentsMargins(0, 10, 10, 0) bottom_layout.setAlignment(QtCore.Qt.AlignVCenter) - bottom_layout.addWidget(pype_logo_label, 0, QtCore.Qt.AlignVCenter) + bottom_layout.addWidget(openpype_logo_label, 0, QtCore.Qt.AlignVCenter) bottom_layout.addStretch(1) bottom_layout.addWidget(self.install_button, 0, QtCore.Qt.AlignVCenter) bottom_layout.addWidget(self.run_button, 0, QtCore.Qt.AlignVCenter) @@ -405,7 +406,7 @@ class InstallDialog(QtWidgets.QDialog): ) # add all to main main.addWidget(self.main_label, 0) - main.addWidget(self.pype_path_label, 0) + main.addWidget(self.openpype_path_label, 0) main.addLayout(input_layout, 0) main.addWidget(self.mongo_label, 0) main.addWidget(self._mongo, 0) @@ -418,9 +419,9 @@ class InstallDialog(QtWidgets.QDialog): self.setLayout(main) - # if mongo url is ok, try to get pype path from there + # if mongo url is ok, try to get openpype path from there if self._mongo.validate_url() and len(self.path) == 0: - self.path = get_pype_path_from_db(self.mongo_url) + self.path = get_openpype_path_from_db(self.mongo_url) self.user_input.setText(self.path) def _on_select_clicked(self): @@ -473,7 +474,7 @@ class InstallDialog(QtWidgets.QDialog): else: self._mongo.set_valid() - if self._pype_run_ready: + if self._openpype_run_ready: self.done(3) return @@ -498,8 +499,8 @@ class InstallDialog(QtWidgets.QDialog): """Change button behaviour based on installation outcome.""" status = result.status if status >= 0: - self.install_button.setText("Run installed Pype") - self._pype_run_ready = True + self.install_button.setText("Run installed OpenPype") + self._openpype_run_ready = True def _update_progress(self, progress: int): self._progress_bar.setValue(progress) @@ -636,7 +637,7 @@ class PathValidator(MongoValidator): """Validate path to be accepted by Igniter. Args: - path (str): path to Pype. + path (str): path to OpenPype. pos (int): current position. Returns: @@ -646,7 +647,7 @@ class PathValidator(MongoValidator): """ # allow empty path as that will use current version coming with - # Pype Igniter + # OpenPype Igniter if len(path) == 0: return self._return_state( QValidator.State.Acceptable, "Use version with Igniter", path) diff --git a/igniter/install_thread.py b/igniter/install_thread.py index a184a19d36..5f9fdef115 100644 --- a/igniter/install_thread.py +++ b/igniter/install_thread.py @@ -8,10 +8,10 @@ from Qt.QtCore import QThread, Signal, QObject # noqa from .bootstrap_repos import ( BootstrapRepos, - PypeVersionInvalid, - PypeVersionIOError, - PypeVersionExists, - PypeVersion + OpenPypeVersionInvalid, + OpenPypeVersionIOError, + OpenPypeVersionExists, + OpenPypeVersion ) from .tools import validate_mongo_connection @@ -26,9 +26,9 @@ class InstallResult(QObject): class InstallThread(QThread): """Install Worker thread. - This class takes care of finding Pype version on user entered path + This class takes care of finding OpenPype version on user entered path (or loading this path from database). If nothing is entered by user, - Pype will create its zip files from repositories that comes with it. + OpenPype will create its zip files from repositories that comes with it. If path contains plain repositories, they are zipped and installed to user data dir. @@ -49,19 +49,19 @@ class InstallThread(QThread): def run(self): """Thread entry point. - Using :class:`BootstrapRepos` to either install Pype as zip files + Using :class:`BootstrapRepos` to either install OpenPype as zip files or copy them from location specified by user or retrieved from database. """ - self.message.emit("Installing Pype ...", False) + self.message.emit("Installing OpenPype ...", False) - # find local version of Pype + # find local version of OpenPype bs = BootstrapRepos( progress_callback=self.set_progress, message=self.message) local_version = bs.get_local_live_version() - # if user did entered nothing, we install Pype from local version. + # if user did entered nothing, we install OpenPype from local version. # zip content of `repos`, copy it to user data dir and append # version to it. if not self._path: @@ -71,7 +71,8 @@ class InstallThread(QThread): if not os.getenv("PYPE_MONGO"): # try to get it from settings registry try: - self._mongo = bs.registry.get_secure_item("pypeMongo") + self._mongo = bs.registry.get_secure_item( + "openPypeMongo") except ValueError: self.message.emit( "!!! We need MongoDB URL to proceed.", True) @@ -81,33 +82,34 @@ class InstallThread(QThread): self._mongo = os.getenv("PYPE_MONGO") else: self.message.emit("Saving mongo connection string ...", False) - bs.registry.set_secure_item("pypeMongo", self._mongo) + bs.registry.set_secure_item("openPypeMongo", self._mongo) os.environ["PYPE_MONGO"] = self._mongo self.message.emit( - f"Detecting installed Pype versions in {bs.data_dir}", False) + f"Detecting installed OpenPype versions in {bs.data_dir}", + False) detected = bs.find_pype(include_zips=True) if detected: - if PypeVersion( + if OpenPypeVersion( version=local_version, path=Path()) < detected[-1]: self.message.emit(( f"Latest installed version {detected[-1]} is newer " f"then currently running {local_version}" ), False) - self.message.emit("Skipping Pype install ...", False) + self.message.emit("Skipping OpenPype install ...", False) if detected[-1].path.suffix.lower() == ".zip": - bs.extract_pype(detected[-1]) + bs.extract_openpype(detected[-1]) self.finished.emit(InstallResult(0)) return - if PypeVersion(version=local_version).get_main_version() == detected[-1].get_main_version(): # noqa + if OpenPypeVersion(version=local_version).get_main_version() == detected[-1].get_main_version(): # noqa self.message.emit(( f"Latest installed version is the same as " f"currently running {local_version}" ), False) - self.message.emit("Skipping Pype install ...", False) + self.message.emit("Skipping OpenPype install ...", False) self.finished.emit(InstallResult(0)) return @@ -118,17 +120,17 @@ class InstallThread(QThread): else: if getattr(sys, 'frozen', False): self.message.emit("None detected.", True) - self.message.emit(("We will use Pype coming with " + self.message.emit(("We will use OpenPype coming with " "installer."), False) - pype_version = bs.create_version_from_frozen_code() - if not pype_version: + openpype_version = bs.create_version_from_frozen_code() + if not openpype_version: self.message.emit( - f"!!! Install failed - {pype_version}", True) + f"!!! Install failed - {openpype_version}", True) self.finished.emit(InstallResult(-1)) return - self.message.emit(f"Using: {pype_version}", False) - bs.install_version(pype_version) - self.message.emit(f"Installed as {pype_version}", False) + self.message.emit(f"Using: {openpype_version}", False) + bs.install_version(openpype_version) + self.message.emit(f"Installed as {openpype_version}", False) self.progress.emit(100) self.finished.emit(InstallResult(1)) return @@ -136,38 +138,38 @@ class InstallThread(QThread): self.message.emit("None detected.", False) self.message.emit( - f"We will use local Pype version {local_version}", False) + f"We will use local OpenPype version {local_version}", False) - local_pype = bs.create_version_from_live_code() - if not local_pype: + local_openpype = bs.create_version_from_live_code() + if not local_openpype: self.message.emit( - f"!!! Install failed - {local_pype}", True) + f"!!! Install failed - {local_openpype}", True) self.finished.emit(InstallResult(-1)) return try: - bs.install_version(local_pype) - except (PypeVersionExists, - PypeVersionInvalid, - PypeVersionIOError) as e: + bs.install_version(local_openpype) + except (OpenPypeVersionExists, + OpenPypeVersionInvalid, + OpenPypeVersionIOError) as e: self.message.emit(f"Installed failed: ", True) self.message.emit(str(e), True) self.finished.emit(InstallResult(-1)) return - self.message.emit(f"Installed as {local_pype}", False) + self.message.emit(f"Installed as {local_openpype}", False) self.progress.emit(100) return else: # if we have mongo connection string, validate it, set it to - # user settings and get PYPE_PATH from there. + # user settings and get OPENPYPE_PATH from there. if self._mongo: if not validate_mongo_connection(self._mongo): self.message.emit( f"!!! invalid mongo url {self._mongo}", True) self.finished.emit(InstallResult(-1)) return - bs.registry.set_secure_item("pypeMongo", self._mongo) + bs.registry.set_secure_item("openPypeMongo", self._mongo) os.environ["PYPE_MONGO"] = self._mongo self.message.emit(f"processing {self._path}", True) diff --git a/igniter/terminal_splash.py b/igniter/terminal_splash.py index 1a7645571e..1d85fd3927 100644 --- a/igniter/terminal_splash.py +++ b/igniter/terminal_splash.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Pype terminal animation.""" +"""OpenPype terminal animation.""" import blessed from pathlib import Path from time import sleep @@ -15,7 +15,7 @@ except AttributeError: def play_animation(): - """Play ASCII art Pype animation.""" + """Play ASCII art OpenPype animation.""" if NO_TERMINAL: return print(term.home + term.clear) diff --git a/igniter/tools.py b/igniter/tools.py index 11fe6b02f2..f25fcb3122 100644 --- a/igniter/tools.py +++ b/igniter/tools.py @@ -2,7 +2,7 @@ """Tools used in **Igniter** GUI. Functions ``compose_url()`` and ``decompose_url()`` are the same as in -``pype.lib`` and they are here to avoid importing pype module before its +``openpype.lib`` and they are here to avoid importing OpenPype module before its version is decided. """ @@ -163,7 +163,7 @@ def validate_mongo_string(mongo: str) -> (bool, str): def validate_path_string(path: str) -> (bool, str): - """Validate string if it is path to Pype repository. + """Validate string if it is path to OpenPype repository. Args: path (str): Path to validate. @@ -187,10 +187,10 @@ def validate_path_string(path: str) -> (bool, str): return True, "valid path" -def get_pype_global_settings(url: str) -> dict: +def get_openpype_global_settings(url: str) -> dict: """Load global settings from Mongo database. - We are loading data from database `pype` and collection `settings`. + We are loading data from database `openpype` and collection `settings`. There we expect document type `global_settings`. Args: @@ -215,7 +215,7 @@ def get_pype_global_settings(url: str) -> dict: # Create mongo connection client = MongoClient(**mongo_kwargs) # Access settings collection - col = client["pype"]["settings"] + col = client["openpype"]["settings"] # Query global settings global_settings = col.find_one({"type": "global_settings"}) or {} # Close Mongo connection @@ -228,22 +228,22 @@ def get_pype_global_settings(url: str) -> dict: return global_settings.get("data") or {} -def get_pype_path_from_db(url: str) -> Union[str, None]: - """Get Pype path from global settings. +def get_openpype_path_from_db(url: str) -> Union[str, None]: + """Get OpenPype path from global settings. Args: url (str): mongodb url. Returns: - path to Pype or None if not found + path to OpenPype or None if not found """ - global_settings = get_pype_global_settings(url) + global_settings = get_openpype_global_settings(url) paths = ( global_settings - .get("pype_path", {}) + .get("openpype_path", {}) .get(platform.system().lower()) ) or [] - # For cases when `pype_path` is a single path + # For cases when `openpype_path` is a single path if paths and isinstance(paths, str): paths = [paths] diff --git a/igniter/user_settings.py b/igniter/user_settings.py index 00ce68cb0b..039f19373b 100644 --- a/igniter/user_settings.py +++ b/igniter/user_settings.py @@ -118,7 +118,7 @@ class ASettingRegistry(): """Delete item from settings. Note: - see :meth:`pype.lib.user_settings.ARegistrySettings.delete_item` + see :meth:`openpype.lib.user_settings.ARegistrySettings.delete_item` """ pass @@ -216,7 +216,7 @@ class IniSettingRegistry(ASettingRegistry): if not os.path.exists(self._registry_file): with open(self._registry_file, mode="w") as cfg: print("# Settings registry", cfg) - print("# Generated by Pype {}".format(version), cfg) + print("# Generated by OpenPype {}".format(version), cfg) now = datetime.now().strftime("%d/%m/%Y %H:%M:%S") print("# {}".format(now), cfg) @@ -350,7 +350,7 @@ class IniSettingRegistry(ASettingRegistry): """Delete item from default section. Note: - See :meth:`~pype.lib.IniSettingsRegistry.delete_item_from_section` + See :meth:`~openpype.lib.IniSettingsRegistry.delete_item_from_section` """ self.delete_item_from_section("MAIN", name) @@ -367,7 +367,7 @@ class JSONSettingRegistry(ASettingRegistry): now = datetime.now().strftime("%d/%m/%Y %H:%M:%S") header = { "__metadata__": { - "pype-version": os.getenv("PYPE_VERSION", "N/A"), + "openpype-version": os.getenv("PYPE_VERSION", "N/A"), "generated": now }, "registry": {} @@ -385,7 +385,7 @@ class JSONSettingRegistry(ASettingRegistry): """Get item value from registry json. Note: - See :meth:`pype.lib.JSONSettingRegistry.get_item` + See :meth:`openpype.lib.JSONSettingRegistry.get_item` """ with open(self._registry_file, mode="r") as cfg: @@ -418,7 +418,7 @@ class JSONSettingRegistry(ASettingRegistry): """Set item value to registry json. Note: - See :meth:`pype.lib.JSONSettingRegistry.set_item` + See :meth:`openpype.lib.JSONSettingRegistry.set_item` """ with open(self._registry_file, "r+") as cfg: @@ -450,8 +450,8 @@ class JSONSettingRegistry(ASettingRegistry): json.dump(data, cfg, indent=4) -class PypeSettingsRegistry(JSONSettingRegistry): - """Class handling Pype general settings registry. +class OpenPypeSettingsRegistry(JSONSettingRegistry): + """Class handling OpenPype general settings registry. Attributes: vendor (str): Name used for path construction. @@ -461,6 +461,7 @@ class PypeSettingsRegistry(JSONSettingRegistry): def __init__(self): self.vendor = "pypeclub" - self.product = "pype" + self.product = "openpype" path = appdirs.user_data_dir(self.product, self.vendor) - super(PypeSettingsRegistry, self).__init__("pype_settings", path) + super(OpenPypeSettingsRegistry, self).__init__( + "openpype_settings", path) diff --git a/repos/avalon-core b/repos/avalon-core index de43124167..911a29a44d 160000 --- a/repos/avalon-core +++ b/repos/avalon-core @@ -1 +1 @@ -Subproject commit de4312416704102a3587802d7a042e75efb99d49 +Subproject commit 911a29a44d5e6a128f4326deb1155184fe811fd7 diff --git a/setup.py b/setup.py index 1c98935000..73950ed7e0 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ excludes = [] bin_includes = [] include_files = [ "igniter", - "openpype", + "pype", "repos", "schema", "vendor", @@ -78,7 +78,7 @@ build_options = dict( optimize=0 ) -icon_path = openpype_root / "igniter" / "pype.ico" +icon_path = openpype_root / "igniter" / "openpype.ico" executables = [ Executable("start.py", base=None, diff --git a/start.py b/start.py index dd9e81a698..e066182c96 100644 --- a/start.py +++ b/start.py @@ -114,15 +114,15 @@ if getattr(sys, 'frozen', False): import igniter # noqa: E402 from igniter import BootstrapRepos # noqa: E402 from igniter.tools import get_pype_path_from_db # noqa -from igniter.bootstrap_repos import PypeVersion # noqa: E402 +from igniter.bootstrap_repos import OpenPypeVersion # noqa: E402 bootstrap = BootstrapRepos() silent_commands = ["run", "igniter", "standalonepublisher", "extractenvironments"] -def set_pype_global_environments() -> None: - """Set global pype's environments.""" +def set_openpype_global_environments() -> None: + """Set global OpenPype's environments.""" import acre from pype.settings import get_environments @@ -148,13 +148,13 @@ def set_pype_global_environments() -> None: def run(arguments: list, env: dict = None) -> int: """Use correct executable to run stuff. - This passing arguments to correct Pype executable. If Pype is run from - live sources, executable will be `python` in virtual environment. - If running from frozen code, executable will be `pype`. Its equivalent in - live code is `python start.py`. + This passing arguments to correct OpenPype executable. If OpenPype is run + from live sources, executable will be `python` in virtual environment. + If running from frozen code, executable will be `openpype_console` or + `openpype_gui`. Its equivalent in live code is `python start.py`. Args: - arguments (list): Argument list to pass Pype. + arguments (list): Argument list to pass OpenPype. env (dict, optional): Dictionary containing environment. Returns: @@ -183,7 +183,7 @@ def set_avalon_environments(): """ from pype import PACKAGE_DIR - # Path to pype's schema + # Path to OpenPype's schema schema_path = os.path.join( os.path.dirname(PACKAGE_DIR), "schema" @@ -194,22 +194,22 @@ def set_avalon_environments(): or os.environ["PYPE_MONGO"] ) os.environ.update({ - # Mongo url (use same as pype has) + # Mongo url (use same as OpenPype has) "AVALON_MONGO": avalon_mongo_url, "AVALON_SCHEMA": schema_path, # Mongo DB name where avalon docs are stored "AVALON_DB": "avalon", # Name of config - "AVALON_CONFIG": "pype", - "AVALON_LABEL": "Pype" + "AVALON_CONFIG": "openpype", + "AVALON_LABEL": "OpenPype" }) def set_modules_environments(): - """Set global environments for pype modules. + """Set global environments for OpenPype modules. - This requires to have pype in `sys.path`. + This requires to have OpenPype in `sys.path`. """ from pype.modules import ModulesManager @@ -270,7 +270,7 @@ def _process_arguments() -> tuple: import igniter return_code = igniter.open_dialog() - # this is when we want to run Pype without installing anything. + # this is when we want to run OpenPype without installing anything. # or we are ready to run. if return_code not in [2, 3]: sys.exit(return_code) @@ -292,11 +292,12 @@ def _determine_mongodb() -> str: """ - pype_mongo = os.getenv("PYPE_MONGO", None) - if not pype_mongo: + openpype_mongo = os.getenv("PYPE_MONGO", None) + if not openpype_mongo: # try system keyring try: - pype_mongo = bootstrap.registry.get_secure_item("pypeMongo") + openpype_mongo = bootstrap.registry.get_secure_item( + "openPypeMongo") except ValueError: print("*** No DB connection string specified.") print("--- launching setup UI ...") @@ -304,34 +305,34 @@ def _determine_mongodb() -> str: igniter.open_dialog() try: - pype_mongo = bootstrap.registry.get_secure_item("pypeMongo") + openpype_mongo = bootstrap.registry.get_secure_item( + "openPypeMongo") except ValueError: raise RuntimeError("missing mongodb url") - return pype_mongo + return openpype_mongo -def _initialize_environment(pype_version: PypeVersion) -> None: - version_path = pype_version.path - os.environ["PYPE_VERSION"] = pype_version.version - # set PYPE_ROOT to point to currently used Pype version. +def _initialize_environment(openpype_version: OpenPypeVersion) -> None: + version_path = openpype_version.path + os.environ["PYPE_VERSION"] = openpype_version.version + # set OPENPYPE_ROOT to point to currently used OpenPype version. os.environ["PYPE_ROOT"] = os.path.normpath(version_path.as_posix()) # inject version to Python environment (sys.path, ...) - print(">>> Injecting Pype version to running environment ...") + print(">>> Injecting OpenPype version to running environment ...") bootstrap.add_paths_from_directory(version_path) - # Additional sys paths related to PYPE_ROOT directory - # TODO move additional paths to `boot` part when PYPE_ROOT will point - # to same hierarchy from code and from frozen pype + # Additional sys paths related to OPENPYPE_ROOT directory + # TODO move additional paths to `boot` part when OPENPYPE_ROOT will point + # to same hierarchy from code and from frozen OpenPype additional_paths = [ - # add pype tools - os.path.join(os.environ["PYPE_ROOT"], "pype", "pype", "tools"), - # add common pype vendor + # add OpenPype tools + os.path.join(os.environ["PYPE_ROOT"], "openpype", "tools"), + # add common OpenPype vendor # (common for multiple Python interpreter versions) os.path.join( os.environ["PYPE_ROOT"], - "pype", - "pype", + "openpype", "vendor", "python", "common" @@ -346,12 +347,12 @@ def _initialize_environment(pype_version: PypeVersion) -> None: os.environ["PYTHONPATH"] = os.pathsep.join(split_paths) -def _find_frozen_pype(use_version: str = None, - use_staging: bool = False) -> Path: - """Find Pype to run from frozen code. +def _find_frozen_openpype(use_version: str = None, + use_staging: bool = False) -> Path: + """Find OpenPype to run from frozen code. This will process and modify environment variables: - ``PYTHONPATH``, ``PYPE_VERSION``, ``PYPE_ROOT`` + ``PYTHONPATH``, ``OPENPYPE_VERSION``, ``OPENPYPE_ROOT`` Args: use_version (str, optional): Try to use specified version. @@ -361,75 +362,75 @@ def _find_frozen_pype(use_version: str = None, Path: Path to version to be used. Raises: - RuntimeError: If no Pype version are found or no staging version + RuntimeError: If no OpenPype version are found or no staging version (if requested). """ - pype_version = None - pype_versions = bootstrap.find_pype(include_zips=True, - staging=use_staging) + openpype_version = None + openpype_versions = bootstrap.find_openpype(include_zips=True, + staging=use_staging) if not os.getenv("PYPE_TRYOUT"): try: # use latest one found (last in the list is latest) - pype_version = pype_versions[-1] + openpype_version = openpype_versions[-1] except IndexError: - # no pype version found, run Igniter and ask for them. - print('*** No Pype versions found.') + # no OpenPype version found, run Igniter and ask for them. + print('*** No OpenPype versions found.') print("--- launching setup UI ...") import igniter return_code = igniter.open_dialog() if return_code == 2: os.environ["PYPE_TRYOUT"] = "1" if return_code == 3: - # run Pype after installation + # run OpenPype after installation - print('>>> Finding Pype again ...') - pype_versions = bootstrap.find_pype(staging=use_staging) + print('>>> Finding OpenPype again ...') + openpype_versions = bootstrap.find_openpype( + staging=use_staging) try: - pype_version = pype_versions[-1] + openpype_version = openpype_versions[-1] except IndexError: print(("!!! Something is wrong and we didn't " "found it again.")) - pype_versions = None sys.exit(1) elif return_code != 2: print(f" . finished ({return_code})") sys.exit(return_code) - if not pype_versions: + if not openpype_versions: # no Pype versions found anyway, lets use then the one - # shipped with frozen Pype + # shipped with frozen OpenPype if not os.getenv("PYPE_TRYOUT"): - print("*** Still no luck finding Pype.") + print("*** Still no luck finding OpenPype.") print(("*** We'll try to use the one coming " - "with Pype installation.")) + "with OpenPype installation.")) version_path = _bootstrap_from_code(use_version) - pype_version = PypeVersion( + openpype_version = OpenPypeVersion( version=BootstrapRepos.get_version(version_path), path=version_path) - _initialize_environment(pype_version) + _initialize_environment(openpype_version) return version_path # get path of version specified in `--use-version` version_path = BootstrapRepos.get_version_path_from_list( - use_version, pype_versions) + use_version, openpype_versions) if not version_path: if use_version is not None: - if not pype_version: + if not openpype_version: ... else: print(("!!! Specified version was not found, using " "latest available")) # specified version was not found so use latest detected. - version_path = pype_version.path - print(f">>> Using version [ {pype_version} ]") + version_path = openpype_version.path + print(f">>> Using version [ {openpype_version} ]") print(f" From {version_path}") # test if latest detected is installed (in user data dir) is_inside = False try: - is_inside = pype_version.path.resolve().relative_to( + is_inside = openpype_version.path.resolve().relative_to( bootstrap.data_dir) except ValueError: # if relative path cannot be calculated, Pype version is not @@ -439,19 +440,19 @@ def _find_frozen_pype(use_version: str = None, if not is_inside: # install latest version to user data dir version_path = bootstrap.install_version( - pype_version, force=True) + openpype_version, force=True) - if pype_version.path.is_file(): + if openpype_version.path.is_file(): print(">>> Extracting zip file ...") - version_path = bootstrap.extract_pype(pype_version) - pype_version.path = version_path + version_path = bootstrap.extract_openpype(openpype_version) + openpype_version.path = version_path - _initialize_environment(pype_version) + _initialize_environment(openpype_version) return version_path def _bootstrap_from_code(use_version): - """Bootstrap live code (or the one coming with frozen Pype. + """Bootstrap live code (or the one coming with frozen OpenPype. Args: use_version: (str): specific version to use. @@ -463,35 +464,35 @@ def _bootstrap_from_code(use_version): # run through repos and add them to `sys.path` and `PYTHONPATH` # set root if getattr(sys, 'frozen', False): - pype_root = os.path.normpath( + openpype_root = os.path.normpath( os.path.dirname(sys.executable)) - local_version = bootstrap.get_version(Path(pype_root)) + local_version = bootstrap.get_version(Path(openpype_root)) print(f" - running version: {local_version}") assert local_version else: - pype_root = os.path.normpath( + openpype_root = os.path.normpath( os.path.dirname( os.path.dirname( os.path.realpath(igniter.__file__)))) - # get current version of Pype + # get current version of OpenPype local_version = bootstrap.get_local_live_version() os.environ["PYPE_VERSION"] = local_version if use_version and use_version != local_version: - pype_versions = bootstrap.find_pype(include_zips=True) + openpype_versions = bootstrap.find_openpype(include_zips=True) version_path = BootstrapRepos.get_version_path_from_list( - use_version, pype_versions) + use_version, openpype_versions) if version_path: # use specified bootstrap.add_paths_from_directory(version_path) os.environ["PYPE_VERSION"] = use_version else: - version_path = pype_root - os.environ["PYPE_ROOT"] = pype_root - repos = os.listdir(os.path.join(pype_root, "repos")) - repos = [os.path.join(pype_root, "repos", repo) for repo in repos] + version_path = openpype_root + os.environ["PYPE_ROOT"] = openpype_root + repos = os.listdir(os.path.join(openpype_root, "repos")) + repos = [os.path.join(openpype_root, "repos", repo) for repo in repos] # add self to python paths - repos.insert(0, pype_root) + repos.insert(0, openpype_root) for repo in repos: sys.path.insert(0, repo) @@ -505,15 +506,15 @@ def _bootstrap_from_code(use_version): # in case when we are running without any version installed. if not getattr(sys, 'frozen', False): split_paths.append(site.getsitepackages()[-1]) - # TODO move additional paths to `boot` part when PYPE_ROOT will point - # to same hierarchy from code and from frozen pype + # TODO move additional paths to `boot` part when OPENPYPE_ROOT will point + # to same hierarchy from code and from frozen OpenPype additional_paths = [ - # add pype tools - os.path.join(os.environ["PYPE_ROOT"], "pype", "tools"), - # add common pype vendor + # add OpenPype tools + os.path.join(os.environ["PYPE_ROOT"], "openpype", "tools"), + # add common OpenPype vendor # (common for multiple Python interpreter versions) os.path.join( - os.environ["PYPE_ROOT"], "pype", "vendor", "python", "common" + os.environ["PYPE_ROOT"], "openpype", "vendor", "python", "common" ) ] for path in additional_paths: @@ -526,7 +527,7 @@ def _bootstrap_from_code(use_version): def boot(): - """Bootstrap Pype.""" + """Bootstrap OpenPype.""" # ------------------------------------------------------------------------ # Play animation @@ -549,38 +550,39 @@ def boot(): # ------------------------------------------------------------------------ try: - pype_mongo = _determine_mongodb() + openpype_mongo = _determine_mongodb() except RuntimeError as e: # without mongodb url we are done for. print(f"!!! {e}") sys.exit(1) - os.environ["PYPE_MONGO"] = pype_mongo + os.environ["PYPE_MONGO"] = openpype_mongo # ------------------------------------------------------------------------ - # Set environments - load Pype path from database (if set) + # Set environments - load OpenPype path from database (if set) # ------------------------------------------------------------------------ - # set PYPE_ROOT to running location until proper version can be + # set OPENPYPE_ROOT to running location until proper version can be # determined. if getattr(sys, 'frozen', False): os.environ["PYPE_ROOT"] = os.path.dirname(sys.executable) else: os.environ["PYPE_ROOT"] = os.path.dirname(__file__) - # Get Pype path from database and set it to environment so Pype can - # find its versions there and bootstrap them. - pype_path = get_pype_path_from_db(pype_mongo) - if not os.getenv("PYPE_PATH") and pype_path: - os.environ["PYPE_PATH"] = pype_path + # Get OpenPype path from database and set it to environment so OpenPype + # can find its versions there and bootstrap them. + openpype_path = get_pype_path_from_db(openpype_mongo) + if not os.getenv("PYPE_PATH") and openpype_path: + os.environ["PYPE_PATH"] = openpype_path # ------------------------------------------------------------------------ - # Find Pype versions + # Find OpenPype versions # ------------------------------------------------------------------------ - # WARNING Environment PYPE_ROOT may change if frozen pype is executed + # WARNING: Environment OPENPYPE_ROOT may change if frozen OpenPype + # is executed if getattr(sys, 'frozen', False): - # find versions of Pype to be used with frozen code + # find versions of OpenPype to be used with frozen code try: - version_path = _find_frozen_pype(use_version, use_staging) + version_path = _find_frozen_openpype(use_version, use_staging) except RuntimeError as e: # no version to run print(f"!!! {e}") @@ -589,7 +591,7 @@ def boot(): version_path = _bootstrap_from_code(use_version) # set this to point either to `python` from venv in case of live code - # or to `pype` or `pype_console` in case of frozen code + # or to `openpype` or `openpype_console` in case of frozen code os.environ["PYPE_EXECUTABLE"] = sys.executable if getattr(sys, 'frozen', False): @@ -598,7 +600,7 @@ def boot(): os.environ["PYPE_REPOS_ROOT"] = os.path.join( os.environ["PYPE_ROOT"], "repos") - # delete Pype module and it's submodules from cache so it is used from + # delete OpenPype module and it's submodules from cache so it is used from # specific version modules_to_del = [ sys.modules.pop(module_name) @@ -618,8 +620,8 @@ def boot(): # Avalon environments must be set before avalon module is imported print(" - for Avalon ...") set_avalon_environments() - print(" - global Pype ...") - set_pype_global_environments() + print(" - global OpenPype ...") + set_openpype_global_environments() print(" - for modules ...") set_modules_environments() @@ -629,7 +631,7 @@ def boot(): assert version_path, "Version path not defined." info = get_info() - info.insert(0, f">>> Using Pype from [ {version_path} ]") + info.insert(0, f">>> Using OpenPype from [ {version_path} ]") t_width = 20 try: @@ -638,7 +640,7 @@ def boot(): # running without terminal pass - _header = f"*** Pype [{__version__}] " + _header = f"*** OpenPype [{__version__}] " info.insert(0, _header + "-" * (t_width - len(_header))) for i in info: @@ -650,7 +652,7 @@ def boot(): cli.main(obj={}, prog_name="pype") except Exception: # noqa exc_info = sys.exc_info() - print("!!! Pype crashed:") + print("!!! OpenPype crashed:") traceback.print_exception(*exc_info) sys.exit(1) @@ -664,10 +666,10 @@ def get_info() -> list: inf = [] if not getattr(sys, 'frozen', False): - inf.append(("Pype variant", "staging")) + inf.append(("OpenPype variant", "staging")) else: - inf.append(("Pype variant", "production")) - inf.append(("Running pype from", os.environ.get('PYPE_ROOT'))) + inf.append(("OpenPype variant", "production")) + inf.append(("Running OpenPype from", os.environ.get('PYPE_ROOT'))) inf.append(("Using mongodb", components["host"])) if os.environ.get("FTRACK_SERVER"): From 490c086ff9f2a0203997d4806759acd53249a5a4 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Thu, 1 Apr 2021 19:01:12 +0200 Subject: [PATCH 8/8] update avalon head --- repos/avalon-core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/avalon-core b/repos/avalon-core index 911a29a44d..09065aaf6b 160000 --- a/repos/avalon-core +++ b/repos/avalon-core @@ -1 +1 @@ -Subproject commit 911a29a44d5e6a128f4326deb1155184fe811fd7 +Subproject commit 09065aaf6b8617a0af0a6f0f82bb1cabf6b0890e