Skip to content

Commit 6cfb4b9

Browse files
committed
[core] plugins: Use Python < 3.10-compatible syntax
When `meshroom_compute` is called with an interpreter that is older than 3.10, the `match/case` syntax raises an error, and the `plugins` module absolutely needs to be imported. This Python 3.10-compatible syntax is thus removed.
1 parent 588303b commit 6cfb4b9

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

meshroom/core/plugins.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,18 @@ def resolveRezSubrequires(self) -> list[str]:
188188
# in the current environment (if they are resolved in it)
189189
for package in subrequires:
190190
packageTuple = self.REZ_DELIMITER_PATTERN.split(package, maxsplit=1)
191-
match len(packageTuple):
192-
case 1:
193-
# Only the package name in the subrequires.
194-
# Search for a corresponding version in the parent environment.
195-
packageName = packageTuple[0]
196-
parentResolvedVersion = resolvedVersions.get(packageName)
197-
if parentResolvedVersion:
198-
packages.append(f"{packageName}=={parentResolvedVersion}")
199-
else:
200-
packages.append(package)
201-
case 2:
202-
# The subrequires ask for a specific version
191+
if len(packageTuple) == 1:
192+
# Only the package name in the subrequires.
193+
# Search for a corresponding version in the parent environment.
194+
packageName = packageTuple[0]
195+
parentResolvedVersion = resolvedVersions.get(packageName)
196+
if parentResolvedVersion:
197+
packages.append(f"{packageName}=={parentResolvedVersion}")
198+
else:
203199
packages.append(package)
200+
elif len(packageTuple) == 2:
201+
# The subrequires ask for a specific version
202+
packages.append(package)
204203

205204
def extractPackageName(packageString: str) -> str:
206205
return self.REZ_DELIMITER_PATTERN.split(packageString, maxsplit=1)[0]

0 commit comments

Comments
 (0)