Merge lp:~james-w/linaro-image-tools/add-script into lp:linaro-image-tools/11.11
Proposed by
James Westby
Status: | Merged |
---|---|
Merged at revision: | 72 |
Proposed branch: | lp:~james-w/linaro-image-tools/add-script |
Merge into: | lp:linaro-image-tools/11.11 |
Prerequisite: | lp:~james-w/linaro-image-tools/hwpack-builder |
Diff against target: |
128 lines (+108/-0) 3 files modified
hwpack/tests/__init__.py (+1/-0) hwpack/tests/test_script.py (+84/-0) linaro-hwpack-create (+23/-0) |
To merge this branch: | bzr merge lp:~james-w/linaro-image-tools/add-script |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zygmunt Krynicki (community) | Approve | ||
Review via email: mp+35130@code.launchpad.net |
Description of the change
Hi,
The final piece of the puzzle, a script that you can run to build
a set of hardware packs.
Should be straightforward given the pieces that came before.
Thanks,
James
To post a comment you must log in.
Hi James
104 +from optparse import OptionParser
110 +if __name__ == '__main__': write(" Requires arguments CONFIG_FILE VERSION\n")
111 + parser = OptionParser()
112 + opts, args = parser.parse_args()
113 + if len(args) < 2:
114 + sys.stderr.
115 + sys.exit(1)
116 + try:
I'd use argparse as it seems to do exactly what you need and is in general superior to optparse.
parser = argparse. ArgumentParser( ) add_argument( "CONFIG_ FILE") add_argument( "VERSION" ) lder(args. CONFIG_ FILE, args.VERSION)
parser.
parser.
args = parser.parse_args()
HardwarePackBui
You could even use type=argparse. FileType( "r") to get various error handlers that understand the act of opening file for reading. This would require changing your API a bit since it returns an open file, not a pathname