mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
cache build version is it probably won't change during process time
This commit is contained in:
parent
406ece7e44
commit
715e1a6d32
1 changed files with 14 additions and 11 deletions
|
|
@ -63,6 +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
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Create OpenPype version.
|
"""Create OpenPype version.
|
||||||
|
|
@ -554,18 +555,20 @@ class OpenPypeVersion(semver.VersionInfo):
|
||||||
|
|
||||||
return sorted(_openpype_versions)
|
return sorted(_openpype_versions)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def get_build_version():
|
def get_build_version(cls):
|
||||||
"""Get version of OpenPype inside build."""
|
"""Get version of OpenPype inside build."""
|
||||||
openpype_root = Path(os.environ["OPENPYPE_ROOT"])
|
if cls._build_version is None:
|
||||||
build_version_str = BootstrapRepos.get_version(openpype_root)
|
openpype_root = Path(os.environ["OPENPYPE_ROOT"])
|
||||||
build_version = None
|
build_version_str = BootstrapRepos.get_version(openpype_root)
|
||||||
if build_version_str:
|
build_version = None
|
||||||
build_version = OpenPypeVersion(
|
if build_version_str:
|
||||||
version=build_version_str,
|
build_version = OpenPypeVersion(
|
||||||
path=openpype_root
|
version=build_version_str,
|
||||||
)
|
path=openpype_root
|
||||||
return build_version
|
)
|
||||||
|
cls._build_version = build_version
|
||||||
|
return cls._build_version
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_latest_version(
|
def get_latest_version(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue