Bug 8321 - yocto-bsp script should use argparse instead of optparse library
Summary: yocto-bsp script should use argparse instead of optparse library
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 1.8
Hardware: All Multiple
: Medium enhancement
Target Milestone: 2.2 M2
Assignee: Humberto Ibarra
QA Contact: David Rodriguez
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-09-17 19:01 UTC by Leonardo Sandoval Gonzalez
Modified: 2016-07-07 14:58 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonardo Sandoval Gonzalez 2015-09-17 19:01:41 UTC
The script yocto-bsp is using the deprecated library optparse to parse the command line arguments which according to the official documentation it is deprecated [1] since 2.7. Corresponding script and libraries should use argparse instead [2].

[1] https://docs.python.org/2/library/optparse.html
[2] https://docs.python.org/2/library/argparse.html#module-argparse
Comment 1 Leonardo Sandoval Gonzalez 2016-03-03 17:40:53 UTC
Enhancement periods missed, moving into 2.2
Comment 2 Humberto Ibarra 2016-06-06 16:30:21 UTC
The current syntax needs to be changed for the list subcommand. Still this bug is not about re-factoring yocto-bsp so will propose a change that works for argparse but altering as little as possible.

The proposed approach is to change 'properties' and 'property' arguments to options for the list subcommand in the following way: 

(Listing karchs)
yocto-bsp list karch

(Listing all properties)
yocto-bsp list <karch> --properties

(Listing possible values for single property)
yocto-bsp list <karch> --property <property>
Comment 3 Benjamin Esquivel 2016-06-06 16:33:34 UTC
it would be good if you put also here how it is currently done, to compare against the proposal.
Comment 4 Humberto Ibarra 2016-06-06 16:40:25 UTC
The current syntax is:

(Listing karchs)
yocto-bsp list karch

(Listing all properties)
yocto-bsp list <karch> properties

(Listing possible values for single property)
yocto-bsp list <karch> property <property>
Comment 5 Benjamin Esquivel 2016-06-06 16:52:57 UTC
I don't think the new format is a deal breaker. I even consider it more appropriate for what we're doing there. (Sub arguments organize better instead of a long positional specification)
Comment 6 Humberto Ibarra 2016-07-04 20:32:25 UTC
Sent patch

https://lists.yoctoproject.org/pipermail/poky/2016-July/010610.html