diff options
| author | Tristan Partin <tristan@partin.io> | 2023-07-12 17:47:12 -0500 |
|---|---|---|
| committer | Tristan Partin <tristan@partin.io> | 2023-07-12 18:56:06 -0500 |
| commit | d4bcf05c39e650d9651b5f2c60e7c12d59367e9c (patch) | |
| tree | 1d635627d62aba0d77142583c7d1479d5e7b4d31 /mesonbuild/compilers/d.py | |
| parent | 921c2370a722cbaa42bd256c699fae3185084939 (diff) | |
| download | meson-d4bcf05c39e650d9651b5f2c60e7c12d59367e9c.tar.gz | |
Annotate naked fundamental Python types
Although mypy wasn't complaining, pyright was.
Diffstat (limited to 'mesonbuild/compilers/d.py')
| -rw-r--r-- | mesonbuild/compilers/d.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 358f8da94..08ebb7583 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -172,7 +172,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): def get_feature_args(self, kwargs: T.Dict[str, T.Any], build_to_src: str) -> T.List[str]: # TODO: using a TypeDict here would improve this - res = [] + res: T.List[str] = [] # get_feature_args can be called multiple times for the same target when there is generated source # so we have to copy the kwargs (target.d_features) dict before popping from it kwargs = kwargs.copy() @@ -277,7 +277,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): # The way that dmd and ldc pass rpath to gcc is different than we would # do directly, each argument -rpath and the value to rpath, need to be # split into two separate arguments both prefaced with the -L=. - args = [] + args: T.List[str] = [] (rpath_args, rpath_dirs_to_remove) = super().build_rpath_args( env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath) for r in rpath_args: @@ -298,7 +298,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): # can understand. # The flags might have been added by pkg-config files, # and are therefore out of the user's control. - dcargs = [] + dcargs: T.List[str] = [] # whether we hit a linker argument that expect another arg # see the comment in the "-L" section link_expect_arg = False @@ -421,7 +421,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): @classmethod def translate_arg_to_windows(cls, arg: str) -> T.List[str]: - args = [] + args: T.List[str] = [] if arg.startswith('-Wl,'): # Translate linker arguments here. linkargs = arg[arg.index(',') + 1:].split(',') @@ -447,7 +447,7 @@ class DmdLikeCompilerMixin(CompilerMixinBase): @classmethod def _translate_arg_to_osx(cls, arg: str) -> T.List[str]: - args = [] + args: T.List[str] = [] if arg.startswith('-install_name'): args.append('-L=' + arg) return args @@ -500,15 +500,14 @@ class DmdLikeCompilerMixin(CompilerMixinBase): # LDC and DMD actually do use a linker, but they proxy all of that with # their own arguments + soargs: T.List[str] = [] if self.linker.id.startswith('ld.'): - soargs = [] for arg in sargs: a, b = arg.split(',', maxsplit=1) soargs.append(a) soargs.append(self.LINKER_PREFIX + b) return soargs elif self.linker.id.startswith('ld64'): - soargs = [] for arg in sargs: if not arg.startswith(self.LINKER_PREFIX): soargs.append(self.LINKER_PREFIX + arg) @@ -589,7 +588,7 @@ class DCompiler(Compiler): def get_feature_args(self, kwargs: T.Dict[str, T.Any], build_to_src: str) -> T.List[str]: # TODO: using a TypeDict here would improve this - res = [] + res: T.List[str] = [] # get_feature_args can be called multiple times for the same target when there is generated source # so we have to copy the kwargs (target.d_features) dict before popping from it kwargs = kwargs.copy() |
