diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-08-30 12:59:56 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-08 20:15:57 +0200 |
commit | 1217cf9a3bf7a49b68539ea1649ad5d8289ca5d1 (patch) | |
tree | 5c2c2b484c7af58c5aedbda4579c87adfdfa4375 | |
parent | a4f4379c44c7f13bc9e44bc01504077af1f3a338 (diff) | |
download | meson-1217cf9a3bf7a49b68539ea1649ad5d8289ca5d1.zip meson-1217cf9a3bf7a49b68539ea1649ad5d8289ca5d1.tar.gz meson-1217cf9a3bf7a49b68539ea1649ad5d8289ca5d1.tar.bz2 |
typing: fully annotate boost and hdf5 deps
-rw-r--r-- | mesonbuild/dependencies/boost.py | 12 | ||||
-rw-r--r-- | mesonbuild/dependencies/hdf5.py | 8 | ||||
-rwxr-xr-x | run_mypy.py | 3 |
3 files changed, 15 insertions, 8 deletions
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 3ad534e..8497d2c 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -339,12 +339,12 @@ class BoostLibraryFile(): return [self.path.as_posix()] class BoostDependency(ExternalDependency): - def __init__(self, environment: Environment, kwargs): + def __init__(self, environment: Environment, kwargs: T.Dict[str, T.Any]) -> None: super().__init__('boost', environment, kwargs, language='cpp') self.debug = environment.coredata.get_builtin_option('buildtype').startswith('debug') self.multithreading = kwargs.get('threading', 'multi') == 'multi' - self.boost_root = None + self.boost_root = None # type: Path self.explicit_static = 'static' in kwargs # Extract and validate modules @@ -385,7 +385,7 @@ class BoostDependency(ExternalDependency): # Finally, look for paths from .pc files and from searching the filesystem self.detect_roots() - def check_and_set_roots(self, roots) -> None: + def check_and_set_roots(self, roots: T.List[Path]) -> None: roots = list(mesonlib.OrderedSet(roots)) for j in roots: # 1. Look for the boost headers (boost/version.hpp) @@ -403,7 +403,7 @@ class BoostDependency(ExternalDependency): self.boost_root = j break - def detect_boost_machine_file(self, props) -> None: + def detect_boost_machine_file(self, props: T.Dict[str, str]) -> None: incdir = props.get('boost_includedir') libdir = props.get('boost_librarydir') @@ -434,7 +434,7 @@ class BoostDependency(ExternalDependency): self.check_and_set_roots(paths) - def detect_boost_env(self): + def detect_boost_env(self) -> None: boost_includedir = get_env_var(self.for_machine, self.env.is_cross_build, 'BOOST_INCLUDEDIR') boost_librarydir = get_env_var(self.for_machine, self.env.is_cross_build, 'BOOST_LIBRARYDIR') @@ -658,7 +658,7 @@ class BoostDependency(ExternalDependency): libs += [BoostLibraryFile(i)] return [x for x in libs if x.is_boost()] # Filter out no boost libraries - def detect_split_root(self, inc_dir, lib_dir) -> None: + def detect_split_root(self, inc_dir: Path, lib_dir: Path) -> None: boost_inc_dir = None for j in [inc_dir / 'version.hpp', inc_dir / 'boost' / 'version.hpp']: if j.is_file(): diff --git a/mesonbuild/dependencies/hdf5.py b/mesonbuild/dependencies/hdf5.py index 6a9bf2d..92277a1 100644 --- a/mesonbuild/dependencies/hdf5.py +++ b/mesonbuild/dependencies/hdf5.py @@ -22,10 +22,14 @@ from .. import mlog from ..mesonlib import split_args, listify from .base import (DependencyException, DependencyMethods, ExternalDependency, ExternalProgram, PkgConfigDependency) +import typing as T + +if T.TYPE_CHECKING: + from ..environment import Environment class HDF5Dependency(ExternalDependency): - def __init__(self, environment, kwargs): + def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None: language = kwargs.get('language', 'c') super().__init__('hdf5', environment, kwargs, language=language) kwargs['required'] = False @@ -127,5 +131,5 @@ class HDF5Dependency(ExternalDependency): return @staticmethod - def get_methods(): + def get_methods() -> T.List[DependencyMethods]: return [DependencyMethods.AUTO, DependencyMethods.PKGCONFIG] diff --git a/run_mypy.py b/run_mypy.py index 5e26ac1..71b6727 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -18,6 +18,7 @@ normal_modules = [ 'mesonbuild/scripts', 'tools', 'mesonbuild/modules/fs.py', + # 'mesonbuild/dependencies/base.py', 'mesonbuild/dependencies/boost.py', 'mesonbuild/dependencies/mpi.py', 'mesonbuild/dependencies/hdf5.py', @@ -37,6 +38,8 @@ strict_modules = [ 'mesonbuild/ast', 'mesonbuild/wrap', 'mesonbuild/scripts', + 'mesonbuild/dependencies/boost.py', + 'mesonbuild/dependencies/hdf5.py', 'run_mypy.py', 'tools', ] |