renamed build verion to installed version

This commit is contained in:
iLLiCiTiT 2021-12-10 10:40:42 +01:00
parent 1b4e5dd443
commit 53e362f3db
2 changed files with 19 additions and 20 deletions

View file

@ -63,7 +63,7 @@ class OpenPypeVersion(semver.VersionInfo):
staging = False staging = False
path = None path = None
_VERSION_REGEX = re.compile(r"(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$") # noqa: E501 _VERSION_REGEX = re.compile(r"(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$") # noqa: E501
_build_version = None _installed_version = None
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Create OpenPype version. """Create OpenPype version.
@ -533,17 +533,16 @@ class OpenPypeVersion(semver.VersionInfo):
return version["__version__"] return version["__version__"]
@classmethod @classmethod
def get_build_version(cls): def get_installed_version(cls):
"""Get version of OpenPype inside build.""" """Get version of OpenPype inside build."""
if cls._build_version is None: if cls._installed_version is None:
openpype_root = Path(os.environ["OPENPYPE_ROOT"]) installed_version_str = cls.get_installed_version_str()
build_version_str = BootstrapRepos.get_version(openpype_root) if installed_version_str:
if build_version_str: cls._installed_version = OpenPypeVersion(
cls._build_version = OpenPypeVersion( version=installed_version_str,
version=build_version_str, path=Path(os.environ["OPENPYPE_ROOT"])
path=openpype_root
) )
return cls._build_version return cls._installed_version
@staticmethod @staticmethod
def get_latest_version( def get_latest_version(
@ -579,7 +578,7 @@ class OpenPypeVersion(semver.VersionInfo):
elif remote is None and not local: elif remote is None and not local:
remote = True remote = True
build_version = OpenPypeVersion.get_build_version() installed_version = OpenPypeVersion.get_installed_version()
local_versions = [] local_versions = []
remote_versions = [] remote_versions = []
if local: if local:
@ -592,7 +591,7 @@ class OpenPypeVersion(semver.VersionInfo):
) )
all_versions = local_versions + remote_versions all_versions = local_versions + remote_versions
if not staging: if not staging:
all_versions.append(build_version) all_versions.append(installed_version)
if not all_versions: if not all_versions:
return None return None
@ -1118,9 +1117,9 @@ class BootstrapRepos:
if isinstance(version, str): if isinstance(version, str):
version = OpenPypeVersion(version=version) version = OpenPypeVersion(version=version)
build_version = OpenPypeVersion.get_build_version() installed_version = OpenPypeVersion.get_installed_version()
if build_version == version: if installed_version == version:
return build_version return installed_version
local_versions = OpenPypeVersion.get_local_versions( local_versions = OpenPypeVersion.get_local_versions(
staging=staging, production=not staging staging=staging, production=not staging
@ -1146,7 +1145,7 @@ class BootstrapRepos:
@staticmethod @staticmethod
def find_latest_openpype_version(staging): def find_latest_openpype_version(staging):
build_version = OpenPypeVersion.get_build_version() installed_version = OpenPypeVersion.get_installed_version()
local_versions = OpenPypeVersion.get_local_versions( local_versions = OpenPypeVersion.get_local_versions(
staging=staging staging=staging
) )
@ -1155,14 +1154,14 @@ class BootstrapRepos:
) )
all_versions = local_versions + remote_versions all_versions = local_versions + remote_versions
if not staging: if not staging:
all_versions.append(build_version) all_versions.append(installed_version)
if not all_versions: if not all_versions:
return None return None
all_versions.sort() all_versions.sort()
latest_version = all_versions[-1] latest_version = all_versions[-1]
if latest_version == build_version: if latest_version == installed_version:
return latest_version return latest_version
if not latest_version.path.is_dir(): if not latest_version.path.is_dir():

View file

@ -665,7 +665,7 @@ def _find_frozen_openpype(use_version: str = None,
""" """
# Collect OpenPype versions # Collect OpenPype versions
build_version = OpenPypeVersion.get_build_version() installed_version = OpenPypeVersion.get_installed_version()
# Expected version that should be used by studio settings # Expected version that should be used by studio settings
# - this option is used only if version is not explictly set and if # - this option is used only if version is not explictly set and if
# studio has set explicit version in settings # studio has set explicit version in settings
@ -719,7 +719,7 @@ def _find_frozen_openpype(use_version: str = None,
# get local frozen version and add it to detected version so if it is # get local frozen version and add it to detected version so if it is
# newer it will be used instead. # newer it will be used instead.
if build_version == openpype_version: if installed_version == openpype_version:
version_path = _bootstrap_from_code(use_version, use_staging) version_path = _bootstrap_from_code(use_version, use_staging)
openpype_version = OpenPypeVersion( openpype_version = OpenPypeVersion(
version=BootstrapRepos.get_version(version_path), version=BootstrapRepos.get_version(version_path),