🐛 filter out non-build versions

and fixing the error message
This commit is contained in:
Ondřej Samohel 2022-08-03 14:26:05 +02:00
parent 3d7e195307
commit 9ed329aebe
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 32 additions and 4 deletions

View file

@ -10,10 +10,23 @@ import re
from Deadline.Scripting import RepositoryUtils, FileUtils, DirectoryUtils
def get_openpype_version_from_path(path):
def get_openpype_version_from_path(path, build=True):
"""Get OpenPype version from provided path.
path (str): Path to scan.
build (bool, optional): Get only builds, not sources
Returns:
str or None: version of OpenPype if found.
"""
version_file = os.path.join(path, "openpype", "version.py")
if not os.path.isfile(version_file):
return None
# skip if the version is not build
if not build and \
(not os.path.isfile(os.path.join(path, "openpype_console")) or
not os.path.isfile(os.path.join(path, "openpype_console.exe"))):
return None
version = {}
with open(version_file, "r") as vf:
exec(vf.read(), version)
@ -101,7 +114,8 @@ def inject_openpype_environment(deadlinePlugin):
if exe == "":
raise RuntimeError(
"OpenPype executable was not found " +
"in the semicolon separated list \"" + exe_list + "\". " +
"in the semicolon separated list " +
"\"" + ";".join(exe_list) + "\". " +
"The path to the render executable can be configured " +
"from the Plugin Configuration in the Deadline Monitor.")

View file

@ -61,10 +61,23 @@ class OpenPypeDeadlinePlugin(DeadlinePlugin):
".*Progress: (\d+)%.*").HandleCallback += self.HandleProgress
@staticmethod
def get_openpype_version_from_path(path):
def get_openpype_version_from_path(path, build=True):
"""Get OpenPype version from provided path.
path (str): Path to scan.
build (bool, optional): Get only builds, not sources
Returns:
str or None: version of OpenPype if found.
"""
version_file = os.path.join(path, "openpype", "version.py")
if not os.path.isfile(version_file):
return None
# skip if the version is not build
if not build and \
(not os.path.isfile(os.path.join(path, "openpype_console")) or
not os.path.isfile(os.path.join(path, "openpype_console.exe"))):
return None
version = {}
with open(version_file, "r") as vf:
exec(vf.read(), version)
@ -136,7 +149,8 @@ class OpenPypeDeadlinePlugin(DeadlinePlugin):
if exe == "":
self.FailRender(
"OpenPype executable was not found " +
"in the semicolon separated list \"" + exe_list + "\". " +
"in the semicolon separated list " +
"\"" + ";".join(exe_list) + "\". " +
"The path to the render executable can be configured " +
"from the Plugin Configuration in the Deadline Monitor.")
return exe