Re: python argparse or alternate method

Konrad Weihmann <kweihmann@...>

There is a single tick missing, but I'm sure you get the point

On 01.04.20 19:37, Konrad Weihmann wrote:

What about

do_configure() {

   cd ${@bb.utils.contains('PACKAGECONFIG_CONFARGS', '--verbose', out/verbose', 'out', d)}


On 01.04.20 18:55, Joel Winarske wrote:

I'm trying the below in a recipe.  Bitbake gives me: ERROR: Unable to parse ...: Exited with "2"

inherit python3native


do_configure() {

    cd ${@get_out_dir(d)}

def get_out_dir(d):
    import os
    import argparse
    pkgconfig_args = d.getVar("PACKAGECONFIG_CONFARGS")

    parser = argparse.ArgumentParser()
    parser.add_argument("--verbose", help="increase output verbosity",
    args = parser.parse_args(pkgconfig_args)
    if args.verbose:
        return os.path.join('out', 'verbose')

    return 'out'

What am I doing wrong, or is there a better way?  Seems like it doesn't like "args = parser.parse_args(pkgconfig_args)"

The output directory is a combination of the arguments.



Join to automatically receive all group messages.