From c4eabfd388e2f8bb435896a4173f1fc873a73d12 Mon Sep 17 00:00:00 2001 From: Kp Date: Tue, 5 Aug 2014 02:43:29 +0000 Subject: [PATCH] Use wider alignment for sconf options SConf option names are long and look bad with the regular alignment. --- SConstruct | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 17ea078f6..6501cb0c6 100644 --- a/SConstruct +++ b/SConstruct @@ -761,9 +761,12 @@ class LazyObjectConstructor: class FilterHelpText: def __init__(self): self.visible_arguments = [] + self._sconf_align = None def FormatVariableHelpText(self, env, opt, help, default, actual, aliases): if not opt in self.visible_arguments: return '' + if not self._sconf_align: + self._sconf_align = len(max((s for s in self.visible_arguments if s[:6] == 'sconf_'), key=len)) l = [] if default is not None: if isinstance(default, str) and not default.isalnum(): @@ -774,7 +777,7 @@ class FilterHelpText: if isinstance(actual, str) and not actual.isalnum(): actual = '"%s"' % actual l.append("current: {current}".format(current=actual)) - return " {opt:13} {help}".format(opt=opt, help=help) + (" [" + "; ".join(l) + "]" if l else '') + '\n' + return (" {opt:%u} {help}" % (self._sconf_align if opt[:6] == 'sconf_' else 15)).format(opt=opt, help=help) + (" [" + "; ".join(l) + "]" if l else '') + '\n' class DXXCommon(LazyObjectConstructor): __shared_program_instance = [0]