aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-10-29 18:25:22 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-10-29 22:47:06 +0300
commitc1b686e39568784a9db572dd3b6a4e4e254daaa7 (patch)
treeaf00dddf1de95d9f9d1496fe78f66098d6922eb8 /mesonbuild/build.py
parentaf85738dafc8b371c8b6dbcfba23e1cdb621dc8c (diff)
downloadmeson-c1b686e39568784a9db572dd3b6a4e4e254daaa7.zip
meson-c1b686e39568784a9db572dd3b6a4e4e254daaa7.tar.gz
meson-c1b686e39568784a9db572dd3b6a4e4e254daaa7.tar.bz2
Make environment objects hash deterministically.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 02e8da9..dd55fc6 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -468,6 +468,14 @@ class EnvironmentVariables(HoldableObject):
repr_str = "<{0}: {1}>"
return repr_str.format(self.__class__.__name__, self.envvars)
+ def hash(self, hasher: T.Any):
+ myenv = self.get_env({})
+ for key in sorted(myenv.keys()):
+ hasher.update(bytes(key, encoding='utf-8'))
+ hasher.update(b',')
+ hasher.update(bytes(myenv[key], encoding='utf-8'))
+ hasher.update(b';')
+
def has_name(self, name: str) -> bool:
return name in self.varnames