mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
🐛 fix finding of last version
This commit is contained in:
parent
8fe29c56d3
commit
312b6d3243
2 changed files with 38 additions and 38 deletions
|
|
@ -514,6 +514,9 @@ class OpenPypeVersion(semver.VersionInfo):
|
||||||
ValueError: if invalid path is specified.
|
ValueError: if invalid path is specified.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
installed_version = OpenPypeVersion.get_installed_version()
|
||||||
|
if not compatible_with:
|
||||||
|
compatible_with = installed_version
|
||||||
_openpype_versions = []
|
_openpype_versions = []
|
||||||
if not openpype_dir.exists() and not openpype_dir.is_dir():
|
if not openpype_dir.exists() and not openpype_dir.is_dir():
|
||||||
return _openpype_versions
|
return _openpype_versions
|
||||||
|
|
@ -540,8 +543,7 @@ class OpenPypeVersion(semver.VersionInfo):
|
||||||
)[0]:
|
)[0]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if compatible_with and not detected_version.is_compatible(
|
if not detected_version.is_compatible(compatible_with):
|
||||||
compatible_with):
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
detected_version.path = item
|
detected_version.path = item
|
||||||
|
|
@ -610,6 +612,8 @@ class OpenPypeVersion(semver.VersionInfo):
|
||||||
remote = True
|
remote = True
|
||||||
|
|
||||||
installed_version = OpenPypeVersion.get_installed_version()
|
installed_version = OpenPypeVersion.get_installed_version()
|
||||||
|
if not compatible_with:
|
||||||
|
compatible_with = installed_version
|
||||||
local_versions = []
|
local_versions = []
|
||||||
remote_versions = []
|
remote_versions = []
|
||||||
if local:
|
if local:
|
||||||
|
|
@ -630,8 +634,7 @@ class OpenPypeVersion(semver.VersionInfo):
|
||||||
all_versions.sort()
|
all_versions.sort()
|
||||||
latest_version: OpenPypeVersion
|
latest_version: OpenPypeVersion
|
||||||
latest_version = all_versions[-1]
|
latest_version = all_versions[-1]
|
||||||
if compatible_with and not latest_version.is_compatible(
|
if not latest_version.is_compatible(compatible_with):
|
||||||
compatible_with):
|
|
||||||
return None
|
return None
|
||||||
return latest_version
|
return latest_version
|
||||||
|
|
||||||
|
|
@ -1153,10 +1156,12 @@ class BootstrapRepos:
|
||||||
versions compatible with specified one.
|
versions compatible with specified one.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
installed_version = OpenPypeVersion.get_installed_version()
|
||||||
|
if not compatible_with:
|
||||||
|
compatible_with = installed_version
|
||||||
if isinstance(version, str):
|
if isinstance(version, str):
|
||||||
version = OpenPypeVersion(version=version)
|
version = OpenPypeVersion(version=version)
|
||||||
|
|
||||||
installed_version = OpenPypeVersion.get_installed_version()
|
|
||||||
if installed_version == version:
|
if installed_version == version:
|
||||||
return installed_version
|
return installed_version
|
||||||
|
|
||||||
|
|
@ -1250,51 +1255,41 @@ class BootstrapRepos:
|
||||||
ok install it as normal version.
|
ok install it as normal version.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
installed_version = OpenPypeVersion.get_installed_version()
|
||||||
|
if not compatible_with:
|
||||||
|
compatible_with = installed_version
|
||||||
if openpype_path and not isinstance(openpype_path, Path):
|
if openpype_path and not isinstance(openpype_path, Path):
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
("Finding OpenPype in non-filesystem locations is"
|
("Finding OpenPype in non-filesystem locations is"
|
||||||
" not implemented yet."))
|
" not implemented yet."))
|
||||||
|
|
||||||
version_dir = ""
|
version_dir = f"{compatible_with.major}.{compatible_with.minor}"
|
||||||
if compatible_with:
|
|
||||||
version_dir = f"{compatible_with.major}.{compatible_with.minor}"
|
|
||||||
|
|
||||||
# if checks bellow for OPENPYPE_PATH and registry fails, use data_dir
|
# if checks bellow for OPENPYPE_PATH and registry fails, use data_dir
|
||||||
# DEPRECATED: lookup in root of this folder is deprecated in favour
|
# DEPRECATED: lookup in root of this folder is deprecated in favour
|
||||||
# of major.minor sub-folders.
|
# of major.minor sub-folders.
|
||||||
dirs_to_search = [
|
dirs_to_search = [self.data_dir, self.data_dir / version_dir]
|
||||||
self.data_dir
|
|
||||||
]
|
|
||||||
if compatible_with:
|
|
||||||
dirs_to_search.append(self.data_dir / version_dir)
|
|
||||||
|
|
||||||
if openpype_path:
|
if openpype_path:
|
||||||
dirs_to_search = [openpype_path]
|
dirs_to_search = [openpype_path, openpype_path / version_dir]
|
||||||
|
elif os.getenv("OPENPYPE_PATH") \
|
||||||
if compatible_with:
|
and Path(os.getenv("OPENPYPE_PATH")).exists():
|
||||||
dirs_to_search.append(openpype_path / version_dir)
|
|
||||||
else:
|
|
||||||
# first try OPENPYPE_PATH and if that is not available,
|
# first try OPENPYPE_PATH and if that is not available,
|
||||||
# try registry.
|
# try registry.
|
||||||
if os.getenv("OPENPYPE_PATH") \
|
dirs_to_search = [Path(os.getenv("OPENPYPE_PATH")),
|
||||||
and Path(os.getenv("OPENPYPE_PATH")).exists():
|
Path(os.getenv("OPENPYPE_PATH")) / version_dir]
|
||||||
dirs_to_search = [Path(os.getenv("OPENPYPE_PATH"))]
|
else:
|
||||||
|
try:
|
||||||
|
registry_dir = Path(
|
||||||
|
str(self.registry.get_item("openPypePath")))
|
||||||
|
if registry_dir.exists():
|
||||||
|
dirs_to_search = [
|
||||||
|
registry_dir, registry_dir / version_dir
|
||||||
|
]
|
||||||
|
|
||||||
if compatible_with:
|
except ValueError:
|
||||||
dirs_to_search.append(
|
# nothing found in registry, we'll use data dir
|
||||||
Path(os.getenv("OPENPYPE_PATH")) / version_dir)
|
pass
|
||||||
else:
|
|
||||||
try:
|
|
||||||
registry_dir = Path(
|
|
||||||
str(self.registry.get_item("openPypePath")))
|
|
||||||
if registry_dir.exists():
|
|
||||||
dirs_to_search = [registry_dir]
|
|
||||||
if compatible_with:
|
|
||||||
dirs_to_search.append(registry_dir / version_dir)
|
|
||||||
|
|
||||||
except ValueError:
|
|
||||||
# nothing found in registry, we'll use data dir
|
|
||||||
pass
|
|
||||||
|
|
||||||
openpype_versions = []
|
openpype_versions = []
|
||||||
for dir_to_search in dirs_to_search:
|
for dir_to_search in dirs_to_search:
|
||||||
|
|
@ -1685,6 +1680,9 @@ class BootstrapRepos:
|
||||||
ValueError: if invalid path is specified.
|
ValueError: if invalid path is specified.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
installed_version = OpenPypeVersion.get_installed_version()
|
||||||
|
if not compatible_with:
|
||||||
|
compatible_with = installed_version
|
||||||
if not openpype_dir.exists() and not openpype_dir.is_dir():
|
if not openpype_dir.exists() and not openpype_dir.is_dir():
|
||||||
raise ValueError(f"specified directory {openpype_dir} is invalid")
|
raise ValueError(f"specified directory {openpype_dir} is invalid")
|
||||||
|
|
||||||
|
|
@ -1711,8 +1709,7 @@ class BootstrapRepos:
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if compatible_with and \
|
if not detected_version.is_compatible(compatible_with):
|
||||||
not detected_version.is_compatible(compatible_with):
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
detected_version.path = item
|
detected_version.path = item
|
||||||
|
|
|
||||||
3
start.py
3
start.py
|
|
@ -629,6 +629,9 @@ def _determine_mongodb() -> str:
|
||||||
|
|
||||||
def _initialize_environment(openpype_version: OpenPypeVersion) -> None:
|
def _initialize_environment(openpype_version: OpenPypeVersion) -> None:
|
||||||
version_path = openpype_version.path
|
version_path = openpype_version.path
|
||||||
|
if not version_path:
|
||||||
|
_print(f"!!! Version {openpype_version} doesn't have path set.")
|
||||||
|
raise ValueError("No path set in specified OpenPype version.")
|
||||||
os.environ["OPENPYPE_VERSION"] = str(openpype_version)
|
os.environ["OPENPYPE_VERSION"] = str(openpype_version)
|
||||||
# set OPENPYPE_REPOS_ROOT to point to currently used OpenPype version.
|
# set OPENPYPE_REPOS_ROOT to point to currently used OpenPype version.
|
||||||
os.environ["OPENPYPE_REPOS_ROOT"] = os.path.normpath(
|
os.environ["OPENPYPE_REPOS_ROOT"] = os.path.normpath(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue