aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2016-09-25 16:56:49 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2016-09-25 18:56:49 +0300
commit3aebdb717a489bd7f8f441ffdfb65dcb71ab3853 (patch)
tree73c7b981a5dd197c51d345b20bc6379750c601fb /mesonbuild/mesonlib.py
parent84d4dc3bbbc59929cb0d2f43b594e2ceff29dacc (diff)
downloadmeson-3aebdb717a489bd7f8f441ffdfb65dcb71ab3853.zip
meson-3aebdb717a489bd7f8f441ffdfb65dcb71ab3853.tar.gz
meson-3aebdb717a489bd7f8f441ffdfb65dcb71ab3853.tar.bz2
configuration_data: can pass descriptions to setters (#783)
Add support for passing a description to configuration data setter methods via a 'description' kwarg. The description string will be used when meson generates the entire configure file without a template, autoconf-style.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index d06e4eb..7294a54 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -221,7 +221,7 @@ def do_replacement(regex, line, confdata):
while match:
varname = match.group(1)
if varname in confdata.keys():
- var = confdata.get(varname)
+ (var, desc) = confdata.get(varname)
if isinstance(var, str):
pass
elif isinstance(var, int):
@@ -240,7 +240,7 @@ def do_mesondefine(line, confdata):
raise MesonException('#mesondefine does not contain exactly two tokens: %s', line.strip())
varname = arr[1]
try:
- v = confdata.get(varname)
+ (v, desc) = confdata.get(varname)
except KeyError:
return '/* #undef %s */\n' % varname
if isinstance(v, bool):
@@ -289,7 +289,9 @@ def dump_conf_header(ofilename, cdata):
''')
for k in sorted(cdata.keys()):
- v = cdata.get(k)
+ (v, desc) = cdata.get(k)
+ if desc:
+ ofile.write('/* %s */\n' % desc)
if isinstance(v, bool):
if v:
ofile.write('#define %s\n\n' % k)