aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-06 23:20:13 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-07-07 04:33:24 -0700
commit4fb00ee1d8c79184e3a77f9266e90d42ff595f41 (patch)
tree401ca0cf5387f9e9662c63a22c5f6cf2ca5bee3a /mesonbuild
parent4dc97a910ef0b9026048b71a020feb74fcc302af (diff)
downloadmeson-4fb00ee1d8c79184e3a77f9266e90d42ff595f41.zip
meson-4fb00ee1d8c79184e3a77f9266e90d42ff595f41.tar.gz
meson-4fb00ee1d8c79184e3a77f9266e90d42ff595f41.tar.bz2
Add new method: mlog.deprecation()
Instead of constructing it manually, use a helper.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/build.py2
-rw-r--r--mesonbuild/coredata.py2
-rw-r--r--mesonbuild/interpreter.py3
-rw-r--r--mesonbuild/interpreterbase.py5
-rw-r--r--mesonbuild/mlog.py5
-rw-r--r--mesonbuild/modules/gnome.py2
6 files changed, 12 insertions, 7 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index dc14326..aa6e70b 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1792,7 +1792,7 @@ class CustomTarget(Target):
if 'build_always' in kwargs and 'build_always_stale' in kwargs:
raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.')
elif 'build_always' in kwargs:
- mlog.warning('build_always is deprecated. Combine build_by_default and build_always_stale instead.')
+ mlog.deprecation('build_always is deprecated. Combine build_by_default and build_always_stale instead.')
if 'build_by_default' not in kwargs:
self.build_by_default = kwargs['build_always']
self.build_always_stale = kwargs['build_always']
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 3725c61..b26516c 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -169,7 +169,7 @@ class UserArrayOption(UserOption):
if len(set(newvalue)) != len(newvalue):
msg = 'Duplicated values in array option "%s" is deprecated. ' \
'This will become a hard error in the future.' % (self.name)
- mlog.log(mlog.red('DEPRECATION:'), msg)
+ mlog.deprecation(msg)
for i in newvalue:
if not isinstance(i, str):
raise MesonException('String array element "{0}" is not a string.'.format(str(newvalue)))
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 9d4a64a..3acb14f 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -276,8 +276,7 @@ class ConfigurationDataHolder(MutableInterpreterObject, ObjectHolder):
def validate_args(self, args, kwargs):
if len(args) == 1 and isinstance(args[0], list) and len(args[0]) == 2:
- mlog.log(mlog.red('DEPRECATION:'),
- '''Passing a list as the single argument to configuration_data.set is deprecated.
+ mlog.deprecation('''Passing a list as the single argument to configuration_data.set is deprecated.
This will become a hard error in the future''')
args = args[0]
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index f61ff47..dfdccb1 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -243,8 +243,9 @@ class FeatureDeprecated(FeatureCheckBase):
return 'Deprecated features used:'
def log_usage_warning(self, tv):
- mlog.warning('Project targetting \'{}\' but tried to use feature deprecated '
- 'since \'{}\': {}'.format(tv, self.feature_version, self.feature_name))
+ mlog.deprecation('Project targetting \'{}\' but tried to use feature '
+ 'deprecated since \'{}\': {}'
+ ''.format(tv, self.feature_version, self.feature_name))
class FeatureCheckKwargsBase:
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index b763e20..b75a267 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -145,6 +145,8 @@ def _log_error(severity, *args, **kwargs):
args = (yellow('WARNING:'),) + args
elif severity == 'error':
args = (red('ERROR:'),) + args
+ elif severity == 'deprecation':
+ args = (red('DEPRECATION:'),) + args
else:
assert False, 'Invalid severity ' + severity
@@ -163,6 +165,9 @@ def error(*args, **kwargs):
def warning(*args, **kwargs):
return _log_error('warning', *args, **kwargs)
+def deprecation(*args, **kwargs):
+ return _log_error('deprecation', *args, **kwargs)
+
def exception(e):
log()
if hasattr(e, 'file') and hasattr(e, 'lineno') and hasattr(e, 'colno'):
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 1732282..f3eabda 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -683,7 +683,7 @@ class GnomeModule(ExtensionModule):
langs = mesonlib.stringlistify(kwargs.pop('languages', []))
if langs:
- mlog.log(mlog.red('DEPRECATION:'), '''The "languages" argument of gnome.yelp() is deprecated.
+ mlog.deprecation('''The "languages" argument of gnome.yelp() is deprecated.
Use a LINGUAS file in the sources directory instead.
This will become a hard error in the future.''')