cros_generate_sysroot: update help strings
Newer argparse doesn't like it when we put % sequences into the help
string directly as it tries to expand it. Rework how we set up the
default to fix.
BUG=chromium:752212
TEST=`cros_generate_sysroot --help` works again
Change-Id: I5fa8a431cf1df963fa04b055463c41ffb79d1328
Reviewed-on: https://chromium-review.googlesource.com/615464
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cros_generate_sysroot.py b/scripts/cros_generate_sysroot.py
index b29b9f2..dab2def 100644
--- a/scripts/cros_generate_sysroot.py
+++ b/scripts/cros_generate_sysroot.py
@@ -32,15 +32,14 @@
help=('The package to generate the sysroot for.'))
parser.add_argument('--out-dir', type='path', required=True,
help='Directory to place the generated tarball.')
- parser.add_argument('--out-file',
- help=('The name to give to the tarball. Defaults to %r.'
- % DEFAULT_NAME))
+ parser.add_argument('--out-file', default=DEFAULT_NAME,
+ help='The name to give to the tarball. '
+ 'Defaults to %(default)s.')
options = parser.parse_args(argv)
- if not options.out_file:
- options.out_file = DEFAULT_NAME % {
- 'package': options.package.replace(PACKAGE_SEPARATOR, '_')
- }
+ options.out_file %= {
+ 'package': options.package.replace(PACKAGE_SEPARATOR, '_'),
+ }
return options