diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-18 11:07:59 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-08-30 18:02:56 -0700 |
commit | aee2325335878b630bcef252e0dcf9507bc30e63 (patch) | |
tree | 8c936d518b1d571e3b197c3c30bd7a1356c88cb3 | |
parent | 38db4602d8f80c3d2aec80ed527e3eed3c41b08c (diff) | |
download | meson-aee2325335878b630bcef252e0dcf9507bc30e63.zip meson-aee2325335878b630bcef252e0dcf9507bc30e63.tar.gz meson-aee2325335878b630bcef252e0dcf9507bc30e63.tar.bz2 |
build: Fully annotate EnvironmentVariables
-rw-r--r-- | mesonbuild/build.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 0143022..62f6f6e 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -427,11 +427,11 @@ class ExtractedObjects(HoldableObject): class EnvironmentVariables(HoldableObject): def __init__(self) -> None: - self.envvars = [] + self.envvars: T.List[T.Tuple[T.Callable[[T.Dict[str, str], str, T.List[str], str], str], str, T.List[str], str]] = [] # The set of all env vars we have operations for. Only used for self.has_name() - self.varnames = set() + self.varnames: T.Set[str] = set() - def __repr__(self): + def __repr__(self) -> str: repr_str = "<{0}: {1}>" return repr_str.format(self.__class__.__name__, self.envvars) @@ -450,14 +450,17 @@ class EnvironmentVariables(HoldableObject): self.varnames.add(name) self.envvars.append((self._prepend, name, values, separator)) - def _set(self, env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: + @staticmethod + def _set(env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: return separator.join(values) - def _append(self, env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: + @staticmethod + def _append(env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: curr = env.get(name) return separator.join(values if curr is None else [curr] + values) - def _prepend(self, env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: + @staticmethod + def _prepend(env: T.Dict[str, str], name: str, values: T.List[str], separator: str) -> str: curr = env.get(name) return separator.join(values if curr is None else values + [curr]) |