aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-04-05 09:22:13 -0700
committerDylan Baker <dylan@pnwbakers.com>2019-04-05 09:26:42 -0700
commit068c3bf60ab04b7803b3bbe57f069a412d9186d3 (patch)
tree3d9065d1fcd6a6cff16ccbe2b0ca58667c24a9d1
parent05ad69a1c7f98b82278916e29964c153c8f39390 (diff)
downloadmeson-068c3bf60ab04b7803b3bbe57f069a412d9186d3.zip
meson-068c3bf60ab04b7803b3bbe57f069a412d9186d3.tar.gz
meson-068c3bf60ab04b7803b3bbe57f069a412d9186d3.tar.bz2
optinterpreter: Add a log argument to is_invalid_name
Since we're adding arguments that use the cross_ prefix but are valid we don't want to print "warning invalid argument name!", as that will confuse people by virtue of being wrong.
-rw-r--r--mesonbuild/optinterpreter.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 5bddbc8..e64ed4e 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -24,15 +24,16 @@ forbidden_option_names = set(coredata.builtin_options.keys())
forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
reserved_prefixes = ['cross_']
-def is_invalid_name(name: str) -> bool:
+def is_invalid_name(name: str, *, log: bool = True) -> bool:
if name in forbidden_option_names:
return True
pref = name.split('_')[0] + '_'
if pref in forbidden_prefixes:
return True
if pref in reserved_prefixes:
- from . import mlog
- mlog.deprecation('Option uses prefix "%s", which is reserved for Meson. This will become an error in the future.' % pref)
+ if log:
+ from . import mlog
+ mlog.deprecation('Option uses prefix "%s", which is reserved for Meson. This will become an error in the future.' % pref)
return False
class OptionException(mesonlib.MesonException):