aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-10 15:00:05 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-08-30 18:02:56 -0700
commit8c90140f2bcc1025cc37c5489ef3f60c469009a5 (patch)
tree9fca6de63b1d101373431135d0ea81230368df42
parentaee2325335878b630bcef252e0dcf9507bc30e63 (diff)
downloadmeson-8c90140f2bcc1025cc37c5489ef3f60c469009a5.zip
meson-8c90140f2bcc1025cc37c5489ef3f60c469009a5.tar.gz
meson-8c90140f2bcc1025cc37c5489ef3f60c469009a5.tar.bz2
build: add ability to set initial value of EnvironmentVariables
Which is useful as we move the validation out of the the EnvironmentVariablesObject
-rw-r--r--mesonbuild/build.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 62f6f6e..bc4065b 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -426,11 +426,15 @@ class ExtractedObjects(HoldableObject):
]
class EnvironmentVariables(HoldableObject):
- def __init__(self) -> None:
+ def __init__(self, values: T.Optional[T.Dict[str, str]] = None) -> None:
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: T.Set[str] = set()
+ if values:
+ for name, value in values.items():
+ self.set(name, [value])
+
def __repr__(self) -> str:
repr_str = "<{0}: {1}>"
return repr_str.format(self.__class__.__name__, self.envvars)