aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-09-06 17:35:21 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-09-22 11:29:03 -0400
commit5d6368e562a5173afa535c26058b6e314738d712 (patch)
treee8c245971c32c5526454b2dcf0c9f9ac041b7000
parentc8b57f1b571b6c6d13bd069bcbb615345602d0ab (diff)
downloadmeson-5d6368e562a5173afa535c26058b6e314738d712.zip
meson-5d6368e562a5173afa535c26058b6e314738d712.tar.gz
meson-5d6368e562a5173afa535c26058b6e314738d712.tar.bz2
mconf: Do not wrap choices manually
We already use textwrap.wrap() for that and it will correctly split on spaces.
-rw-r--r--mesonbuild/mconf.py22
1 files changed, 3 insertions, 19 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 0c07a35..2ac12dd 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -156,26 +156,10 @@ class Conf:
else:
value = make_lower_case(value)
- if choices:
- if isinstance(choices, list):
- choices_list = make_lower_case(choices)
- current = '['
- while choices_list:
- i = choices_list.pop(0)
- if len(current) + len(i) >= self.max_choices_line_length:
- self._add_line(name, value, current + ',', descr)
- name = ''
- value = ''
- descr = ''
- current = ' '
- if len(current) > 1:
- current += ', '
- current += i
- choices = current + ']'
- else:
- choices = make_lower_case(choices)
+ if isinstance(choices, list):
+ choices = '[{}]'.format(', '.join(make_lower_case(choices)))
else:
- choices = ''
+ choices = make_lower_case(choices)
self._add_line(name, value, choices, descr)