]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
scripts/lib/argparse_oe: handle intermixing of optional positional arguments
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 22 Dec 2015 04:03:08 +0000 (17:03 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 22 Dec 2015 16:44:03 +0000 (16:44 +0000)
commit98fd5de373e16fe5d69a3065f844efc8037385bc
tree6f893fa92729821a83126e76e1546ed070bed7ad
parentc0754d672966901f22dff1bcd40bbd08d1219c7a
scripts/lib/argparse_oe: handle intermixing of optional positional arguments

Python's argparse module can't handle when several optional positional
arguments (set with nargs='?') are intermixed with other options. If the
positional arguments aren't optional then this isn't an issue; thus when
changing positional arguments to optional (as we are doing with devtool)
we need this workaround.

This is a pretty horrible hack, but we don't want this flexibility of
ordering to disappear simply because we made some arguments optional.
Unfortunately the corresponding bug remains unresolved upstream even in
Python 3, and argparse is not really designed to be subclassed so it
doesn't make things like this easy.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/argparse_oe.py