aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
diff options
context:
space:
mode:
authorAaron Small <a.small@unb.ca>2017-03-21 23:38:24 -0400
committerAaron Small <a.small@unb.ca>2017-04-09 03:31:39 -0400
commit76c8491d770d558d4140789e01a9cb74701600ff (patch)
treebc55211a73dfc410bd811db6762373ebb32294d6 /mesonbuild/mlog.py
parentb89af8b6dd0efc97867be96e91630d8a1c4d3316 (diff)
downloadmeson-76c8491d770d558d4140789e01a9cb74701600ff.zip
meson-76c8491d770d558d4140789e01a9cb74701600ff.tar.gz
meson-76c8491d770d558d4140789e01a9cb74701600ff.tar.bz2
Add an option to dependencies called 'method'. This can be used to
configure a detection method, for those types of dependencies that have more than one means of detection. The default detection methods are unchanged if 'method' is not specified, and all dependencies support the method 'auto', which is the same as not specifying a method. The dependencies which do support multiple detection methods additionally support other values, depending on the dependency.
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r--mesonbuild/mlog.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index bad756a..82ee6ba 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -99,3 +99,16 @@ def log(*args, **kwargs):
def warning(*args, **kwargs):
log(yellow('WARNING:'), *args, **kwargs)
+
+# Format a list for logging purposes as a string. It separates
+# all but the last item with commas, and the last with 'and'.
+def format_list(list):
+ l = len(list)
+ if l > 2:
+ return ' and '.join([', '.join(list[:-1]), list[-1]])
+ elif l == 2:
+ return ' and '.join(list)
+ elif l == 1:
+ return list[0]
+ else:
+ return ''