[OE-core] [wic patch 2/5] wic: Use argparse instead of optparse

Andreas Reichel Andreas.Reichel at tngtech.com
Wed Apr 26 10:34:15 UTC 2017


On Sun, Apr 23, 2017 at 08:58:44PM +0100, Burton, Ross wrote:

> 
> On 21 April 2017 at 13:11, Andreas J. Reichel <andreas.reichel at tngtech.com>
> wrote:
> 
>     * optparse is deprecated and will not be developed further
>         (see: https://docs.python.org/2/library/optparse.html)
>     * argparse supports subcommands, which simplifies definition of
>         arguments and options
>     * reimplement help mechanism through sub-subcommands
> 
> 
> This results in a behaviour change and breaks the selftest:
> 
> FAIL [0.535s]: test_unsupported_subcommand (oeqa.selftest.wic.Wic)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/
> build/meta/lib/oeqa/utils/decorators.py", line 109, in wrapped_f
>     return func(*args, **kwargs)
>   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/
> build/meta/lib/oeqa/selftest/wic.py", line 163, in test_unsupported_subcommand
>     ignore_status=True).status)
> AssertionError: 1 != 2
> 
Dear Ross,

I see three possible strategies in fixing this problem:
- Change the code to keep current return values / behavior
- Adapt the unit test to fit the new code
- Write a less complex patch for just adding the option
  "--keep-partition-images" without migration to argparse

Which way would you prefer it?

Andreas

> Ross

-- 
Andreas Reichel 
Dipl.-Phys. (Univ.) 
Software Consultant

Andreas.Reichel at tngtech.com 
+49-174-3180074

TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Christoph Stock, Dr. Robert Dahlke
Sitz: Unterföhring * Amtsgericht München * HRB 135082



More information about the Openembedded-core mailing list