diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-12-31 16:50:52 +0000 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-01-01 13:20:55 +0000 |
commit | 2ed875e1b49d06d677d299534f2f8290bfbd3b35 (patch) | |
tree | e71094f1c387a4b34ad5ba5c61d5c85ac776741f /mesonbuild/mlog.py | |
parent | d4985d981fea5ec026745efb41be88f25d41bb32 (diff) | |
download | meson-2ed875e1b49d06d677d299534f2f8290bfbd3b35.zip meson-2ed875e1b49d06d677d299534f2f8290bfbd3b35.tar.gz meson-2ed875e1b49d06d677d299534f2f8290bfbd3b35.tar.bz2 |
Consolidate warning location formatting in mlog.warning()
Also use .format() rather than %
Also use build.environment rather than hardcoding 'meson.build'
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r-- | mesonbuild/mlog.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index a0d07ec..aa2ac20 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -103,6 +103,13 @@ def log(*args, **kwargs): force_print(*arr, **kwargs) def warning(*args, **kwargs): + from . import environment + + if kwargs.get('location'): + location = kwargs['location'] + del kwargs['location'] + args += ('in file {}, line {}.'.format(os.path.join(location.subdir, environment.build_filename), location.lineno),) + log(yellow('WARNING:'), *args, **kwargs) # Format a list for logging purposes as a string. It separates |