Comparing a number with None is not a good idea: >>> (0 < None, 0 > None) (False, True)
This patch also adds build-bash-completion to the list of checked Python scripts and wraps one line of more than 80 characters. Signed-off-by: Michael Hanselmann <[email protected]> --- Makefile.am | 1 + autotools/build-bash-completion | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 718775e..8aa6430 100644 --- a/Makefile.am +++ b/Makefile.am @@ -351,6 +351,7 @@ srclink_files = \ $(all_python_code) check_python_code = \ + autotools/build-bash-completion \ $(all_python_code) devel/upload: devel/upload.in $(REPLACE_VARS_SED) diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion index 0d03cf8..aa130d4 100755 --- a/autotools/build-bash-completion +++ b/autotools/build-bash-completion @@ -465,11 +465,11 @@ class CompletionWriter: if arg.min == 1 and arg.max == 1: cmpcode = """"$arg_idx" == %d""" % (last_arg_end) + elif arg.max is None: + cmpcode = """"$arg_idx" -ge %d""" % (last_arg_end) elif arg.min <= arg.max: cmpcode = (""""$arg_idx" -ge %d && "$arg_idx" -lt %d""" % (last_arg_end, last_arg_end + arg.max)) - elif arg.max is None: - cmpcode = """"$arg_idx" -ge %d""" % (last_arg_end) else: raise Exception("Unable to generate argument position condition") @@ -487,7 +487,8 @@ class CompletionWriter: if choices: sw.Write("""choices="$choices "%s""", choices) if compgenargs: - sw.Write("compgenargs=%s", utils.ShellQuote(" ".join(compgenargs))) + sw.Write("compgenargs=%s", + utils.ShellQuote(" ".join(compgenargs))) finally: sw.DecIndent() -- 1.6.4.3
