Skip to content

Commit 422f929

Browse files
committed
scripts: drop redundant argparser 'dest' args
These are the defaults automatically provided by argparse. This hopefully slightly improves readability of the code. Signed-off-by: Markus Lehtonen <[email protected]>
1 parent 964074e commit 422f929

15 files changed

+263
-375
lines changed

gbp/scripts/buildpackage.py

+35-38
Original file line numberDiff line numberDiff line change
@@ -346,72 +346,69 @@ def build_parser(name, prefix=None):
346346
export_group = parser.add_argument_group("export build-tree options",
347347
"alternative build tree related options")
348348

349-
parser.add_bool_conf_file_arg("--ignore-new", dest="ignore_new")
350-
parser.add_arg("--verbose", action="store_true", dest="verbose",
349+
parser.add_bool_conf_file_arg("--ignore-new")
350+
parser.add_arg("--verbose", action="store_true",
351351
help="verbose command execution")
352-
parser.add_conf_file_arg("--color", dest="color", type='tristate')
353-
parser.add_conf_file_arg("--color-scheme",
354-
dest="color_scheme")
355-
parser.add_conf_file_arg("--notify", dest="notify", type='tristate')
356-
tag_group.add_arg("--tag", action="store_true", dest="tag",
352+
parser.add_conf_file_arg("--color", type='tristate')
353+
parser.add_conf_file_arg("--color-scheme")
354+
parser.add_conf_file_arg("--notify", type='tristate')
355+
tag_group.add_arg("--tag", action="store_true",
357356
help="create a tag after a successful build")
358-
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
357+
tag_group.add_arg("--tag-only", action="store_true",
359358
help="don't build, only tag and run the posttag hook")
360-
tag_group.add_arg("--retag", action="store_true", dest="retag",
359+
tag_group.add_arg("--retag", action="store_true",
361360
help="don't fail if the tag already exists")
362-
tag_group.add_bool_conf_file_arg("--sign-tags", dest="sign_tags")
363-
tag_group.add_conf_file_arg("--keyid", dest="keyid")
364-
tag_group.add_conf_file_arg("--debian-tag", dest="debian_tag")
365-
tag_group.add_conf_file_arg("--debian-tag-msg", dest="debian_tag_msg")
366-
tag_group.add_conf_file_arg("--upstream-tag", dest="upstream_tag")
367-
orig_group.add_conf_file_arg("--upstream-tree", dest="upstream_tree")
368-
orig_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar")
369-
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
370-
dest="pristine_tar_commit")
371-
orig_group.add_conf_file_arg("--force-create", dest="force_create",
361+
tag_group.add_bool_conf_file_arg("--sign-tags")
362+
tag_group.add_conf_file_arg("--keyid")
363+
tag_group.add_conf_file_arg("--debian-tag")
364+
tag_group.add_conf_file_arg("--debian-tag-msg")
365+
tag_group.add_conf_file_arg("--upstream-tag")
366+
orig_group.add_conf_file_arg("--upstream-tree")
367+
orig_group.add_bool_conf_file_arg("--pristine-tar")
368+
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
369+
orig_group.add_conf_file_arg("--force-create",
372370
help="force creation of orig tarball", action="store_true")
373-
orig_group.add_conf_file_arg("--no-create-orig", dest="no_create_orig",
371+
orig_group.add_conf_file_arg("--no-create-orig",
374372
help="don't create orig tarball", action="store_true")
375-
orig_group.add_conf_file_arg("--tarball-dir", dest="tarball_dir", type="path",
373+
orig_group.add_conf_file_arg("--tarball-dir", type="path",
376374
help="location to look for external tarballs")
377375
orig_group.add_conf_file_arg("--compression", dest="comp_type",
378376
help="Compression type")
379377
orig_group.add_conf_file_arg("--compression-level", dest="comp_level",
380378
help="Compression level")
381379
orig_group.add_conf_file_arg("--component", action="append", metavar='COMPONENT',
382380
dest="components")
383-
branch_group.add_conf_file_arg("--upstream-branch", dest="upstream_branch")
384-
branch_group.add_conf_file_arg("--debian-branch", dest="debian_branch")
385-
branch_group.add_bool_conf_file_arg("--ignore-branch", dest="ignore_branch")
381+
branch_group.add_conf_file_arg("--upstream-branch")
382+
branch_group.add_conf_file_arg("--debian-branch")
383+
branch_group.add_bool_conf_file_arg("--ignore-branch")
386384
branch_group.add_bool_conf_file_arg("--submodules", dest="with_submodules")
387-
cmd_group.add_conf_file_arg("--builder", dest="builder",
385+
cmd_group.add_conf_file_arg("--builder",
388386
help="command to build the Debian package")
389-
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
387+
cmd_group.add_conf_file_arg("--cleaner",
390388
help="command to clean the working copy")
391-
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
389+
cmd_group.add_conf_file_arg("--prebuild",
392390
help="hook to run before a build")
393-
cmd_group.add_conf_file_arg("--postexport", dest="postexport",
391+
cmd_group.add_conf_file_arg("--postexport",
394392
help="hook to run after exporting the source tree")
395-
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
393+
cmd_group.add_conf_file_arg("--postbuild",
396394
help="hook run after a successful build")
397-
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
395+
cmd_group.add_conf_file_arg("--posttag",
398396
help="hook run after a successful tag operation")
399397
cmd_group.add_bool_conf_file_arg("--pbuilder", dest="use_pbuilder")
400398
cmd_group.add_bool_conf_file_arg("--qemubuilder", dest="use_qemubuilder")
401399
cmd_group.add_conf_file_arg("--dist", dest="pbuilder_dist")
402400
cmd_group.add_conf_file_arg("--arch", dest="pbuilder_arch")
403-
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf",
404-
dest="pbuilder_autoconf")
405-
cmd_group.add_conf_file_arg("--pbuilder-options", dest="pbuilder_options")
406-
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
407-
export_group.add_conf_file_arg("--export-dir", dest="export_dir", type="path",
401+
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf")
402+
cmd_group.add_conf_file_arg("--pbuilder-options")
403+
cmd_group.add_bool_conf_file_arg("--hooks")
404+
export_group.add_conf_file_arg("--export-dir", type="path",
408405
help="before building the package export "
409406
"the source into EXPORT_DIR")
410-
export_group.add_conf_file_arg("--export", dest="export",
407+
export_group.add_conf_file_arg("--export",
411408
help="export treeish object TREEISH",
412409
metavar="TREEISH")
413-
export_group.add_bool_conf_file_arg("--purge", dest="purge")
414-
export_group.add_bool_conf_file_arg("--overlay", dest="overlay")
410+
export_group.add_bool_conf_file_arg("--purge")
411+
export_group.add_bool_conf_file_arg("--overlay")
415412
return parser
416413

417414

gbp/scripts/buildpackage_rpm.py

+39-63
Original file line numberDiff line numberDiff line change
@@ -304,99 +304,75 @@ def build_parser(name, prefix=None, git_treeish=None):
304304
export_group = parser.add_argument_group("export build-tree options",
305305
"alternative build tree related options")
306306

307-
parser.add_bool_conf_file_arg("--ignore-new",
308-
dest="ignore_new")
309-
parser.add_arg("--verbose", action="store_true", dest="verbose",
307+
parser.add_bool_conf_file_arg("--ignore-new")
308+
parser.add_arg("--verbose", action="store_true",
310309
help="verbose command execution")
311-
parser.add_conf_file_arg("--tmp-dir", dest="tmp_dir")
312-
parser.add_conf_file_arg("--color", dest="color",
310+
parser.add_conf_file_arg("--tmp-dir")
311+
parser.add_conf_file_arg("--color",
313312
type='tristate')
314-
parser.add_conf_file_arg("--color-scheme",
315-
dest="color_scheme")
316-
parser.add_conf_file_arg("--notify", dest="notify",
313+
parser.add_conf_file_arg("--color-scheme")
314+
parser.add_conf_file_arg("--notify",
317315
type='tristate')
318-
parser.add_conf_file_arg("--vendor", action="store",
319-
dest="vendor")
320-
parser.add_conf_file_arg("--native", dest="native",
316+
parser.add_conf_file_arg("--vendor", action="store")
317+
parser.add_conf_file_arg("--native",
321318
type='tristate')
322-
tag_group.add_arg("--tag", action="store_true", dest="tag",
319+
tag_group.add_arg("--tag", action="store_true",
323320
help="create a tag after a successful build")
324-
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
321+
tag_group.add_arg("--tag-only", action="store_true",
325322
help="don't build, only tag and run the posttag hook")
326-
tag_group.add_arg("--retag", action="store_true", dest="retag",
323+
tag_group.add_arg("--retag", action="store_true",
327324
help="don't fail if the tag already exists")
328-
tag_group.add_bool_conf_file_arg("--sign-tags",
329-
dest="sign_tags")
330-
tag_group.add_conf_file_arg("--keyid", dest="keyid")
331-
tag_group.add_conf_file_arg("--packaging-tag",
332-
dest="packaging_tag")
333-
tag_group.add_conf_file_arg("--packaging-tag-msg",
334-
dest="packaging_tag_msg")
335-
tag_group.add_conf_file_arg("--upstream-tag",
336-
dest="upstream_tag")
337-
orig_group.add_conf_file_arg("--upstream-tree",
338-
dest="upstream_tree")
339-
orig_group.add_bool_conf_file_arg("--pristine-tar",
340-
dest="pristine_tar")
341-
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
342-
dest="pristine_tar_commit")
343-
orig_group.add_conf_file_arg("--force-create",
344-
dest="force_create", action="store_true",
325+
tag_group.add_bool_conf_file_arg("--sign-tags")
326+
tag_group.add_conf_file_arg("--keyid")
327+
tag_group.add_conf_file_arg("--packaging-tag")
328+
tag_group.add_conf_file_arg("--packaging-tag-msg")
329+
tag_group.add_conf_file_arg("--upstream-tag")
330+
orig_group.add_conf_file_arg("--upstream-tree")
331+
orig_group.add_bool_conf_file_arg("--pristine-tar")
332+
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
333+
orig_group.add_conf_file_arg("--force-create", action="store_true",
345334
help="force creation of upstream source tarball")
346-
orig_group.add_conf_file_arg("--no-create-orig",
347-
dest="no_create_orig", action="store_true",
335+
orig_group.add_conf_file_arg("--no-create-orig", action="store_true",
348336
help="don't create upstream source tarball")
349-
orig_group.add_conf_file_arg("--tarball-dir",
350-
dest="tarball_dir", type="path",
337+
orig_group.add_conf_file_arg("--tarball-dir", type="path",
351338
help="location to look for external tarballs")
352339
orig_group.add_conf_file_arg("--compression-level",
353340
dest="comp_level",
354341
help="Compression level")
355-
branch_group.add_conf_file_arg("--upstream-branch",
356-
dest="upstream_branch")
357-
branch_group.add_conf_file_arg("--packaging-branch",
358-
dest="packaging_branch")
359-
branch_group.add_bool_conf_file_arg("--ignore-branch",
360-
dest="ignore_branch")
342+
branch_group.add_conf_file_arg("--upstream-branch")
343+
branch_group.add_conf_file_arg("--packaging-branch")
344+
branch_group.add_bool_conf_file_arg("--ignore-branch")
361345
branch_group.add_bool_conf_file_arg("--submodules",
362346
dest="with_submodules")
363-
cmd_group.add_conf_file_arg("--builder", dest="builder",
347+
cmd_group.add_conf_file_arg("--builder",
364348
help="command to build the package")
365-
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
349+
cmd_group.add_conf_file_arg("--cleaner",
366350
help="command to clean the working copy")
367-
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
351+
cmd_group.add_conf_file_arg("--prebuild",
368352
help="command to run before a build")
369353
cmd_group.add_conf_file_arg("--postexport",
370-
dest="postexport",
371354
help="command to run after exporting the source tree")
372-
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
355+
cmd_group.add_conf_file_arg("--postbuild",
373356
help="hook run after a successful build")
374-
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
357+
cmd_group.add_conf_file_arg("--posttag",
375358
help="hook run after a successful tag operation")
376359
cmd_group.add_bool_conf_file_arg("--mock", dest="use_mock")
377360
cmd_group.add_conf_file_arg("--dist", dest="mock_dist")
378361
cmd_group.add_conf_file_arg("--arch", dest="mock_arch")
379-
cmd_group.add_conf_file_arg("--mock-root", dest="mock_root")
380-
cmd_group.add_conf_file_arg("--mock-options", dest="mock_options")
381-
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
362+
cmd_group.add_conf_file_arg("--mock-root")
363+
cmd_group.add_conf_file_arg("--mock-options")
364+
cmd_group.add_bool_conf_file_arg("--hooks")
382365
export_group.add_arg("--no-build", action="store_true",
383-
dest="no_build",
384366
help="Don't run builder or the associated hooks")
385-
export_group.add_conf_file_arg("--export-dir",
386-
dest="export_dir", type="path",
367+
export_group.add_conf_file_arg("--export-dir", type="path",
387368
help="Build topdir, also export the sources under "
388369
"EXPORT_DIR")
389-
export_group.add_conf_file_arg("--export-specdir",
390-
dest="export_specdir", type="path")
391-
export_group.add_conf_file_arg("--export-sourcedir",
392-
dest="export_sourcedir", type="path")
393-
export_group.add_conf_file_arg("--export", dest="export",
394-
metavar="TREEISH",
370+
export_group.add_conf_file_arg("--export-specdir", type="path")
371+
export_group.add_conf_file_arg("--export-sourcedir", type="path")
372+
export_group.add_conf_file_arg("--export", metavar="TREEISH",
395373
help="export treeish object TREEISH")
396-
export_group.add_conf_file_arg("--packaging-dir",
397-
dest="packaging_dir")
398-
export_group.add_conf_file_arg("--spec-file",
399-
dest="spec_file")
374+
export_group.add_conf_file_arg("--packaging-dir")
375+
export_group.add_conf_file_arg("--spec-file")
400376
return parser
401377

402378

gbp/scripts/clone.py

+13-15
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,25 @@ def build_parser(name):
109109
branch_group = parser.add_argument_group("branch options", "branch tracking and layout options")
110110
cmd_group = parser.add_argument_group("external command options", "how and when to invoke hooks")
111111

112-
branch_group.add_arg("--all", action="store_true", dest="all",
112+
branch_group.add_arg("--all", action="store_true",
113113
help="track all branches, not only debian and upstream")
114-
branch_group.add_conf_file_arg("--upstream-branch", dest="upstream_branch")
115-
branch_group.add_conf_file_arg("--debian-branch", dest="debian_branch")
116-
branch_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar")
117-
branch_group.add_arg("--depth", action="store", dest="depth", default=0,
114+
branch_group.add_conf_file_arg("--upstream-branch")
115+
branch_group.add_conf_file_arg("--debian-branch")
116+
branch_group.add_bool_conf_file_arg("--pristine-tar")
117+
branch_group.add_arg("--depth", action="store", default=0,
118118
help="git history depth (for creating shallow clones)")
119-
branch_group.add_arg("--reference", action="store", dest="reference", default=None,
119+
branch_group.add_arg("--reference", action="store", default=None,
120120
help="git reference repository (use local copies where possible)")
121-
cmd_group.add_conf_file_arg("--postclone", dest="postclone",
121+
cmd_group.add_conf_file_arg("--postclone",
122122
help="hook to run after cloning the source tree")
123-
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
123+
cmd_group.add_bool_conf_file_arg("--hooks")
124124

125-
parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
125+
parser.add_arg("-v", "--verbose", action="store_true",
126126
help="verbose command execution")
127-
parser.add_conf_file_arg("--color", dest="color", type='tristate')
128-
parser.add_conf_file_arg("--color-scheme", dest="color_scheme")
129-
parser.add_conf_file_arg("--repo-user", dest="repo_user",
130-
choices=['DEBIAN', 'GIT'])
131-
parser.add_conf_file_arg("--repo-email", dest="repo_email",
132-
choices=['DEBIAN', 'GIT'])
127+
parser.add_conf_file_arg("--color", type='tristate')
128+
parser.add_conf_file_arg("--color-scheme")
129+
parser.add_conf_file_arg("--repo-user", choices=['DEBIAN', 'GIT'])
130+
parser.add_conf_file_arg("--repo-email", choices=['DEBIAN', 'GIT'])
133131
parser.add_argument("repository", metavar="REPOSITORY",
134132
help="repository to clone")
135133
parser.add_argument("directory", metavar="DIRECTORY", nargs="?",

gbp/scripts/create_remote_repo.py

+8-18
Original file line numberDiff line numberDiff line change
@@ -232,33 +232,23 @@ def build_parser(name, sections=[]):
232232
"branch layout and tracking options")
233233
branch_group.add_conf_file_arg("--remote-url-pattern",
234234
dest="remote_url")
235-
branch_group.add_conf_file_arg("--upstream-branch",
236-
dest="upstream_branch")
237-
branch_group.add_conf_file_arg("--debian-branch",
238-
dest="debian_branch")
239-
branch_group.add_bool_conf_file_arg("--pristine-tar",
240-
dest="pristine_tar")
241-
branch_group.add_bool_conf_file_arg("--track",
242-
dest='track')
243-
branch_group.add_bool_conf_file_arg("--bare",
244-
dest='bare')
235+
branch_group.add_conf_file_arg("--upstream-branch")
236+
branch_group.add_conf_file_arg("--debian-branch")
237+
branch_group.add_bool_conf_file_arg("--pristine-tar")
238+
branch_group.add_bool_conf_file_arg("--track")
239+
branch_group.add_bool_conf_file_arg("--bare")
245240
parser.add_arg("-v", "--verbose",
246241
action="store_true",
247-
dest="verbose",
248242
help="verbose command execution")
249243
parser.add_conf_file_arg("--color",
250-
dest="color",
251244
type='tristate')
252-
parser.add_conf_file_arg("--color-scheme",
253-
dest="color_scheme")
245+
parser.add_conf_file_arg("--color-scheme")
254246
parser.add_arg("--remote-name",
255247
dest="name",
256248
default="origin",
257249
help="The name of the remote, default is 'origin'")
258-
parser.add_conf_file_arg("--template-dir",
259-
dest="template_dir")
260-
parser.add_conf_file_arg("--remote-config",
261-
dest="remote_config")
250+
parser.add_conf_file_arg("--template-dir")
251+
parser.add_conf_file_arg("--remote-config")
262252
parser.add_argument("action", metavar="ACTION", nargs="?",
263253
default="create", choices=('create', 'list'),
264254
help="action to take")

0 commit comments

Comments
 (0)