diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-02-17 10:10:18 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-02-17 20:19:34 +0200 |
commit | ea1ad718aaa66982a3dde5d50638ed680dfe4ed6 (patch) | |
tree | 85d28cacb8ddf30e058035784406c0234d4bbc0d | |
parent | 683c768feddcf074c86eb09e810495eacf8a187a (diff) | |
download | meson-ea1ad718aaa66982a3dde5d50638ed680dfe4ed6.zip meson-ea1ad718aaa66982a3dde5d50638ed680dfe4ed6.tar.gz meson-ea1ad718aaa66982a3dde5d50638ed680dfe4ed6.tar.bz2 |
mconf: Limit the line length of the choices column
-rw-r--r-- | mesonbuild/mconf.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 18bb37b..cd9d35a 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -41,6 +41,7 @@ class Conf: if 'meson.build' in [os.path.basename(self.build_dir), self.build_dir]: self.build_dir = os.path.dirname(self.build_dir) self.build = None + self.max_choices_line_length = 60 if os.path.isdir(os.path.join(self.build_dir, 'meson-private')): self.build = build.load(self.build_dir) @@ -100,7 +101,20 @@ class Conf: if opt['choices']: choices_found = True if isinstance(opt['choices'], list): - choices_col.append('[{0}]'.format(', '.join(make_lower_case(opt['choices'])))) + choices_list = make_lower_case(opt['choices']) + current = '[' + while choices_list: + i = choices_list.pop(0) + if len(current) + len(i) >= self.max_choices_line_length: + choices_col.append(current + ',') + name_col.append('') + value_col.append('') + descr_col.append('') + current = ' ' + if len(current) > 1: + current += ', ' + current += i + choices_col.append(current + ']') else: choices_col.append(make_lower_case(opt['choices'])) else: |