cargo: avoid AttributeError if cargolock is None

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2025-10-24 12:58:35 +02:00
committed by Dylan Baker
parent 6c88d99921
commit ae311ae85c

View File

@ -258,6 +258,8 @@ class Interpreter:
def _fetch_package_from_subproject(self, package_name: str, meson_depname: str) -> PackageState:
subp_name, _ = self.environment.wrap_resolver.find_dep_provider(meson_depname)
if subp_name is None:
if self.cargolock is None:
raise MesonException(f'Dependency {meson_depname!r} not found in any wrap files.')
# If Cargo.lock has a different version, this could be a resolution
# bug, but maybe also a version mismatch? I am not sure yet...
similar_deps = [pkg.subproject