Skip to content

Commit a7a610e

Browse files
committed
[core] Rez plugins: Ensure dependencies for meshroom_compute are present
`psutil` is a dependency of `meshroom_compute`, which cannot run if it is not part of the environment. For rez plugins, if `psutil` is not already part of the plugin's environment, it is added. No version is specified so it can be resolved in the environment, without being aligned on Meshroom's.
1 parent 772ed15 commit a7a610e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

meshroom/core/desc/node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
_MESHROOM_ROOT = Path(meshroom.__file__).parent.parent.as_posix()
1919
_MESHROOM_COMPUTE = (Path(_MESHROOM_ROOT) / "bin" / "meshroom_compute").as_posix()
20+
_MESHROOM_COMPUTE_DEPS = ["psutil"]
2021

2122

2223
class MrNodeType(enum.Enum):

meshroom/core/plugins.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from meshroom.common import BaseObject
1616
from meshroom.core import desc
17-
from meshroom.core.desc.node import _MESHROOM_ROOT
17+
from meshroom.core.desc.node import _MESHROOM_ROOT, _MESHROOM_COMPUTE_DEPS
1818

1919

2020
def validateNodeDesc(nodeDesc: desc.Node) -> list:
@@ -158,10 +158,10 @@ def __init__(self, folder: str, configEnv: dict[str: str], uri: str = ""):
158158

159159
def resolveRezSubrequires(self) -> list[str]:
160160
"""
161-
Return the list of packages defined for the node execution. These execution packages are named
162-
subrequires.
163-
Note: If a package does not have a version number, the version is aligned with the main Meshroom
164-
environment (if this package is defined).
161+
Return the list of packages defined for the node execution. These execution packages are
162+
named subrequires.
163+
Note: If a package does not have a version number, the version is aligned with the main
164+
Meshroom environment (if this package is defined).
165165
"""
166166
subrequires = os.environ.get(f"{self.uri.upper()}_SUBREQUIRES", "").split(os.pathsep)
167167
packages = []
@@ -194,6 +194,15 @@ def resolveRezSubrequires(self) -> list[str]:
194194
if not definedInParentEnv:
195195
packages.append(package)
196196

197+
for package in _MESHROOM_COMPUTE_DEPS:
198+
# For packages that are required by meshroom_compute, do not specify any version
199+
# or align it with Meshroom's: the version will be found during the resolution of
200+
# the environment based on the other packages.
201+
# If any of these packages is already part of the environment a plugin's dependency,
202+
# do not add it
203+
if not package in " ".join(packages):
204+
packages.append(package)
205+
197206
logging.debug("Packages for the execution environment: " + ", ".join(packages))
198207
return packages
199208

0 commit comments

Comments
 (0)