Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meshroom/core/desc/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

_MESHROOM_ROOT = Path(meshroom.__file__).parent.parent.as_posix()
_MESHROOM_COMPUTE = (Path(_MESHROOM_ROOT) / "bin" / "meshroom_compute").as_posix()
_MESHROOM_COMPUTE_DEPS = ["psutil"]


class MrNodeType(enum.Enum):
Expand Down
27 changes: 20 additions & 7 deletions meshroom/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from meshroom.common import BaseObject
from meshroom.core import desc
from meshroom.core.desc.node import _MESHROOM_ROOT
from meshroom.core.desc.node import _MESHROOM_ROOT, _MESHROOM_COMPUTE_DEPS


def validateNodeDesc(nodeDesc: desc.Node) -> list:
Expand Down Expand Up @@ -161,10 +161,10 @@ def __init__(self, folder: str, configEnv: dict[str: str], uri: str = ""):

def resolveRezSubrequires(self) -> list[str]:
"""
Return the list of packages defined for the node execution. These execution packages are named
subrequires.
Note: If a package does not have a version number, the version is aligned with the main Meshroom
environment (if this package is defined).
Return the list of packages defined for the node execution. These execution packages are
named subrequires.
Note: If a package does not have a version number, the version is aligned with the main
Meshroom environment (if this package is defined).
"""
subrequires = os.environ.get(f"{self.uri.upper()}_SUBREQUIRES", "").split(os.pathsep)
if not subrequires:
Expand All @@ -184,8 +184,8 @@ def resolveRezSubrequires(self) -> list[str]:
resolvedVersions[name] = version
logging.debug("Packages in the current environment: " + ", ".join(currentEnvPackages))

# Take packages with the set versions for those which have one, and try to take packages in the current
# environment (if they are resolved in it)
# Take packages with the set versions for those which have one, and try to take packages
# in the current environment (if they are resolved in it)
for package in subrequires:
packageTuple = self.REZ_DELIMITER_PATTERN.split(package, maxsplit=1)
match len(packageTuple):
Expand All @@ -202,6 +202,19 @@ def resolveRezSubrequires(self) -> list[str]:
# The subrequires ask for a specific version
packages.append(package)

def extractPackageName(packageString: str) -> str:
return self.REZ_DELIMITER_PATTERN.split(packageString, maxsplit=1)[0]
packageNames = [extractPackageName(package) for package in packages]

for package in _MESHROOM_COMPUTE_DEPS:
# For packages that are required by meshroom_compute, do not specify any version
# or align it with Meshroom's: the version will be found during the resolution of
# the environment based on the other packages.
# If any of these packages is already part of the environment a plugin's dependency,
# do not add it
if package not in packageNames:
packages.append(package)

logging.debug("Packages for the execution environment: " + ", ".join(packages))
return packages

Expand Down
Loading