aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-05-13 12:10:25 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-05-14 11:04:51 -0700
commit4e9e35f3bd17a8f110ae1d3b40c8fbe04700120a (patch)
tree9867fa157519ce5d7bcc77143046ec5efdee949c /mesonbuild/interpreterbase.py
parent93dc9cfcc3ef946680ebe4724977c4b93ffa4a0f (diff)
downloadmeson-4e9e35f3bd17a8f110ae1d3b40c8fbe04700120a.zip
meson-4e9e35f3bd17a8f110ae1d3b40c8fbe04700120a.tar.gz
meson-4e9e35f3bd17a8f110ae1d3b40c8fbe04700120a.tar.bz2
interpreterbase: Allow passing an extra message in feature/deprecation warnings
The intended use it to tell people the new thing to do.
Diffstat (limited to 'mesonbuild/interpreterbase.py')
-rw-r--r--mesonbuild/interpreterbase.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index 82d16f1..af9018b 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -220,9 +220,10 @@ class FeatureCheckBase(metaclass=abc.ABCMeta):
# This will be overwritten by the subclasses by necessity
feature_registry = {} # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
- def __init__(self, feature_name: str, version: str):
+ def __init__(self, feature_name: str, version: str, extra_message: T.Optional[str] = None):
self.feature_name = feature_name # type: str
self.feature_version = version # type: str
+ self.extra_message = extra_message or '' # type: str
@staticmethod
def get_target_version(subproject: str) -> str:
@@ -302,8 +303,15 @@ class FeatureNew(FeatureCheckBase):
return 'Project specifies a minimum meson_version \'{}\' but uses features which were added in newer versions:'.format(tv)
def log_usage_warning(self, tv: str) -> None:
- mlog.warning('Project targeting \'{}\' but tried to use feature introduced '
- 'in \'{}\': {}'.format(tv, self.feature_version, self.feature_name))
+ args = [
+ 'Project targeting', "'{}'".format(tv),
+ 'but tried to use feature introduced in',
+ "'{}':".format(self.feature_version),
+ '{}.'.format(self.feature_name),
+ ]
+ if self.extra_message:
+ args.append(self.extra_message)
+ mlog.warning(*args)
class FeatureDeprecated(FeatureCheckBase):
"""Checks for deprecated features"""
@@ -323,9 +331,15 @@ class FeatureDeprecated(FeatureCheckBase):
return 'Deprecated features used:'
def log_usage_warning(self, tv: str) -> None:
- mlog.deprecation('Project targeting \'{}\' but tried to use feature '
- 'deprecated since \'{}\': {}'
- ''.format(tv, self.feature_version, self.feature_name))
+ args = [
+ 'Project targeting', "'{}'".format(tv),
+ 'but tried to use feature deprecated since',
+ "'{}':".format(self.feature_version),
+ '{}.'.format(self.feature_name),
+ ]
+ if self.extra_message:
+ args.append(self.extra_message)
+ mlog.warning(*args)
class FeatureCheckKwargsBase: