aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-05-12 10:55:31 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-05-14 12:15:03 -0700
commite35584e9ff33a2cba8128487b14b0a3dcfe9fbc5 (patch)
tree67ec8436310ef3861f122afffc624ffd030bacca /mesonbuild/mesonlib.py
parentd51551231ffa19c48ec5a5c36da11e7f03921262 (diff)
downloadmeson-e35584e9ff33a2cba8128487b14b0a3dcfe9fbc5.zip
meson-e35584e9ff33a2cba8128487b14b0a3dcfe9fbc5.tar.gz
meson-e35584e9ff33a2cba8128487b14b0a3dcfe9fbc5.tar.bz2
interpreter: Add always set default value for version and set it ASAP
Ideally we wouldn't need to have the default dict here and could just rely on it being set as soon as project is called. There is a corner case exercised by test case common/35 run program, which is that if a FeatureNew or FeatureDeprecated is called to generate the meson version it will be unset, to work around this I've changed the type from a dict to a default dict with '' as the default value. A better fix would probably be to store all of the FeatureNew/FeatureDeprecated checks until the end, then evaluate them, but for now this results in no loss of functionality, only more functionality, even if it isn't prefect.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index b901ec9..26fe6eb 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -39,8 +39,10 @@ _U = T.TypeVar('_U')
have_fcntl = False
have_msvcrt = False
+# TODO: this is such a hack, this really should be either in coredata or in the
+# interpreter
# {subproject: project_meson_version}
-project_meson_versions = {} # type: T.Dict[str, str]
+project_meson_versions = collections.defaultdict(str) # type: T.DefaultDict[str, str]
try:
import fcntl