wrap: correct return annotation of `Resolver.get_from_wrapdb()`

It returns `None | PackageDefinition`, not `PackageDefinition`
pull/12057/merge
Dylan Baker 9 months ago
parent 413c288d0d
commit 9a493f541f
  1. 9
      mesonbuild/wrap/wrap.py

@ -351,7 +351,7 @@ class Resolver:
self.wrapdb_provided_deps.update({i: name for i in info.get('dependency_names', [])})
self.wrapdb_provided_programs.update({i: name for i in info.get('program_names', [])})
def get_from_wrapdb(self, subp_name: str) -> PackageDefinition:
def get_from_wrapdb(self, subp_name: str) -> T.Optional[PackageDefinition]:
info = self.wrapdb.get(subp_name)
if not info:
return None
@ -405,11 +405,10 @@ class Resolver:
self.packagename = packagename
self.directory = packagename
wrap = self.wraps.get(packagename)
if not wrap:
if wrap is None:
wrap = self.get_from_wrapdb(packagename)
if not wrap:
m = f'Neither a subproject directory nor a {self.packagename}.wrap file was found.'
raise WrapNotFoundException(m)
if wrap is None:
raise WrapNotFoundException(f'Neither a subproject directory nor a {self.packagename}.wrap file was found.')
self.wrap = wrap
self.directory = self.wrap.directory

Loading…
Cancel
Save