diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-06-17 09:55:58 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-06-18 09:52:23 -0700 |
commit | 6d52ddf3c7f80810f09be93cfcf2a5cf537cd07d (patch) | |
tree | cd0505e7fa1c88cc5728d6531954db9c622ab031 | |
parent | 3ec2cf9c60d42735f26b3539c6dfc9af7aead7ca (diff) | |
download | meson-6d52ddf3c7f80810f09be93cfcf2a5cf537cd07d.zip meson-6d52ddf3c7f80810f09be93cfcf2a5cf537cd07d.tar.gz meson-6d52ddf3c7f80810f09be93cfcf2a5cf537cd07d.tar.bz2 |
build: add type annotations for the IncludeDirs object
-rw-r--r-- | mesonbuild/build.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 436a55d..d75aa16 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -327,28 +327,30 @@ class Build: return link_args.get(compiler.get_language(), []) class IncludeDirs: - def __init__(self, curdir, dirs, is_system, extra_build_dirs=None): + + """Internal representation of an include_directories call.""" + + def __init__(self, curdir: str, dirs: T.List[str], is_system: bool, + extra_build_dirs: T.Optional[T.List[str]] = None): self.curdir = curdir self.incdirs = dirs self.is_system = is_system + # Interpreter has validated that all given directories # actually exist. - if extra_build_dirs is None: - self.extra_build_dirs = [] - else: - self.extra_build_dirs = extra_build_dirs + self.extra_build_dirs: T.List[str] = extra_build_dirs or [] - def __repr__(self): + def __repr__(self) -> str: r = '<{} {}/{}>' return r.format(self.__class__.__name__, self.curdir, self.incdirs) - def get_curdir(self): + def get_curdir(self) -> str: return self.curdir - def get_incdirs(self): + def get_incdirs(self) -> T.List[str]: return self.incdirs - def get_extra_build_dirs(self): + def get_extra_build_dirs(self) -> T.List[str]: return self.extra_build_dirs def to_string_list(self, sourcedir: str) -> T.List[str]: |