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_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', [])}) 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) info = self.wrapdb.get(subp_name)
if not info: if not info:
return None return None
@ -405,11 +405,10 @@ class Resolver:
self.packagename = packagename self.packagename = packagename
self.directory = packagename self.directory = packagename
wrap = self.wraps.get(packagename) wrap = self.wraps.get(packagename)
if not wrap: if wrap is None:
wrap = self.get_from_wrapdb(packagename) wrap = self.get_from_wrapdb(packagename)
if not wrap: if wrap is None:
m = f'Neither a subproject directory nor a {self.packagename}.wrap file was found.' raise WrapNotFoundException(f'Neither a subproject directory nor a {self.packagename}.wrap file was found.')
raise WrapNotFoundException(m)
self.wrap = wrap self.wrap = wrap
self.directory = self.wrap.directory self.directory = self.wrap.directory

Loading…
Cancel
Save