Skip to content

Commit 1efcedf

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 5e36d15 commit 1efcedf

17 files changed

+281
-403
lines changed

gbp/scripts/buildpackage.py

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

355-
parser.add_bool_conf_file_arg("--ignore-new", dest="ignore_new")
356-
parser.add_arg("--verbose", action="store_true", dest="verbose",
355+
parser.add_bool_conf_file_arg("--ignore-new")
356+
parser.add_arg("--verbose", action="store_true",
357357
help="verbose command execution")
358-
parser.add_conf_file_arg("--color", dest="color", type='tristate')
359-
parser.add_conf_file_arg("--color-scheme",
360-
dest="color_scheme")
361-
parser.add_conf_file_arg("--notify", dest="notify", type='tristate')
362-
tag_group.add_arg("--tag", action="store_true", dest="tag",
358+
parser.add_conf_file_arg("--color", type='tristate')
359+
parser.add_conf_file_arg("--color-scheme")
360+
parser.add_conf_file_arg("--notify", type='tristate')
361+
tag_group.add_arg("--tag", action="store_true",
363362
help="create a tag after a successful build")
364-
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
363+
tag_group.add_arg("--tag-only", action="store_true",
365364
help="don't build, only tag and run the posttag hook")
366-
tag_group.add_arg("--retag", action="store_true", dest="retag",
365+
tag_group.add_arg("--retag", action="store_true",
367366
help="don't fail if the tag already exists")
368-
tag_group.add_bool_conf_file_arg("--sign-tags", dest="sign_tags")
369-
tag_group.add_conf_file_arg("--keyid", dest="keyid")
370-
tag_group.add_conf_file_arg("--debian-tag", dest="debian_tag")
371-
tag_group.add_conf_file_arg("--debian-tag-msg", dest="debian_tag_msg")
372-
tag_group.add_conf_file_arg("--upstream-tag", dest="upstream_tag")
373-
orig_group.add_conf_file_arg("--upstream-tree", dest="upstream_tree")
374-
orig_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar")
375-
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
376-
dest="pristine_tar_commit")
377-
orig_group.add_conf_file_arg("--force-create", dest="force_create",
367+
tag_group.add_bool_conf_file_arg("--sign-tags")
368+
tag_group.add_conf_file_arg("--keyid")
369+
tag_group.add_conf_file_arg("--debian-tag")
370+
tag_group.add_conf_file_arg("--debian-tag-msg")
371+
tag_group.add_conf_file_arg("--upstream-tag")
372+
orig_group.add_conf_file_arg("--upstream-tree")
373+
orig_group.add_bool_conf_file_arg("--pristine-tar")
374+
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
375+
orig_group.add_conf_file_arg("--force-create",
378376
help="force creation of orig tarball", action="store_true")
379-
orig_group.add_conf_file_arg("--no-create-orig", dest="no_create_orig",
377+
orig_group.add_conf_file_arg("--no-create-orig",
380378
help="don't create orig tarball", action="store_true")
381-
orig_group.add_conf_file_arg("--tarball-dir", dest="tarball_dir", type="path",
379+
orig_group.add_conf_file_arg("--tarball-dir", type="path",
382380
help="location to look for external tarballs")
383381
orig_group.add_conf_file_arg("--compression", dest="comp_type",
384382
help="Compression type")
385383
orig_group.add_conf_file_arg("--compression-level", dest="comp_level",
386384
help="Compression level")
387385
orig_group.add_conf_file_arg("--component", action="append", metavar='COMPONENT',
388386
dest="components")
389-
branch_group.add_conf_file_arg("--upstream-branch", dest="upstream_branch")
390-
branch_group.add_conf_file_arg("--debian-branch", dest="debian_branch")
391-
branch_group.add_bool_conf_file_arg("--ignore-branch", dest="ignore_branch")
387+
branch_group.add_conf_file_arg("--upstream-branch")
388+
branch_group.add_conf_file_arg("--debian-branch")
389+
branch_group.add_bool_conf_file_arg("--ignore-branch")
392390
branch_group.add_bool_conf_file_arg("--submodules", dest="with_submodules")
393-
cmd_group.add_conf_file_arg("--builder", dest="builder",
391+
cmd_group.add_conf_file_arg("--builder",
394392
help="command to build the Debian package")
395-
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
393+
cmd_group.add_conf_file_arg("--cleaner",
396394
help="command to clean the working copy")
397-
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
395+
cmd_group.add_conf_file_arg("--prebuild",
398396
help="hook to run before a build")
399-
cmd_group.add_conf_file_arg("--postexport", dest="postexport",
397+
cmd_group.add_conf_file_arg("--postexport",
400398
help="hook to run after exporting the source tree")
401-
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
399+
cmd_group.add_conf_file_arg("--postbuild",
402400
help="hook run after a successful build")
403-
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
401+
cmd_group.add_conf_file_arg("--posttag",
404402
help="hook run after a successful tag operation")
405403
cmd_group.add_bool_conf_file_arg("--pbuilder", dest="use_pbuilder")
406404
cmd_group.add_bool_conf_file_arg("--qemubuilder", dest="use_qemubuilder")
407405
cmd_group.add_conf_file_arg("--dist", dest="pbuilder_dist")
408406
cmd_group.add_conf_file_arg("--arch", dest="pbuilder_arch")
409-
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf",
410-
dest="pbuilder_autoconf")
411-
cmd_group.add_conf_file_arg("--pbuilder-options", dest="pbuilder_options")
412-
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
413-
export_group.add_conf_file_arg("--export-dir", dest="export_dir", type="path",
407+
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf")
408+
cmd_group.add_conf_file_arg("--pbuilder-options")
409+
cmd_group.add_bool_conf_file_arg("--hooks")
410+
export_group.add_conf_file_arg("--export-dir", type="path",
414411
help="before building the package export "
415412
"the source into EXPORT_DIR")
416-
export_group.add_conf_file_arg("--export", dest="export",
413+
export_group.add_conf_file_arg("--export",
417414
help="export treeish object TREEISH",
418415
metavar="TREEISH")
419-
export_group.add_bool_conf_file_arg("--purge", dest="purge")
420-
export_group.add_bool_conf_file_arg("--overlay", dest="overlay")
416+
export_group.add_bool_conf_file_arg("--purge")
417+
export_group.add_bool_conf_file_arg("--overlay")
421418
return parser
422419

423420

gbp/scripts/buildpackage_rpm.py

+40-64
Original file line numberDiff line numberDiff line change
@@ -321,100 +321,76 @@ def build_parser(name, prefix=None, git_treeish=None):
321321
export_group = parser.add_argument_group("export build-tree options",
322322
"alternative build tree related options")
323323

324-
parser.add_bool_conf_file_arg("--ignore-new",
325-
dest="ignore_new")
326-
parser.add_arg("--verbose", action="store_true", dest="verbose",
324+
parser.add_bool_conf_file_arg("--ignore-new")
325+
parser.add_arg("--verbose", action="store_true",
327326
help="verbose command execution")
328-
parser.add_conf_file_arg("--tmp-dir", dest="tmp_dir")
329-
parser.add_conf_file_arg("--color", dest="color",
327+
parser.add_conf_file_arg("--tmp-dir")
328+
parser.add_conf_file_arg("--color",
330329
type='tristate')
331-
parser.add_conf_file_arg("--color-scheme",
332-
dest="color_scheme")
333-
parser.add_conf_file_arg("--notify", dest="notify",
330+
parser.add_conf_file_arg("--color-scheme")
331+
parser.add_conf_file_arg("--notify",
334332
type='tristate')
335-
parser.add_conf_file_arg("--vendor", action="store",
336-
dest="vendor")
337-
parser.add_conf_file_arg("--native", dest="native",
333+
parser.add_conf_file_arg("--vendor", action="store")
334+
parser.add_conf_file_arg("--native",
338335
type='tristate')
339-
tag_group.add_arg("--tag", action="store_true", dest="tag",
336+
tag_group.add_arg("--tag", action="store_true",
340337
help="create a tag after a successful build")
341-
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
338+
tag_group.add_arg("--tag-only", action="store_true",
342339
help="don't build, only tag and run the posttag hook")
343-
tag_group.add_arg("--retag", action="store_true", dest="retag",
340+
tag_group.add_arg("--retag", action="store_true",
344341
help="don't fail if the tag already exists")
345-
tag_group.add_bool_conf_file_arg("--sign-tags",
346-
dest="sign_tags")
347-
tag_group.add_conf_file_arg("--keyid", dest="keyid")
348-
tag_group.add_conf_file_arg("--packaging-tag",
349-
dest="packaging_tag")
350-
tag_group.add_conf_file_arg("--packaging-tag-msg",
351-
dest="packaging_tag_msg")
352-
tag_group.add_conf_file_arg("--upstream-tag",
353-
dest="upstream_tag")
354-
orig_group.add_conf_file_arg("--upstream-tree",
355-
dest="upstream_tree")
356-
orig_group.add_bool_conf_file_arg("--pristine-tar",
357-
dest="pristine_tar")
358-
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
359-
dest="pristine_tar_commit")
360-
orig_group.add_conf_file_arg("--force-create",
361-
dest="force_create", action="store_true",
342+
tag_group.add_bool_conf_file_arg("--sign-tags")
343+
tag_group.add_conf_file_arg("--keyid")
344+
tag_group.add_conf_file_arg("--packaging-tag")
345+
tag_group.add_conf_file_arg("--packaging-tag-msg")
346+
tag_group.add_conf_file_arg("--upstream-tag")
347+
orig_group.add_conf_file_arg("--upstream-tree")
348+
orig_group.add_bool_conf_file_arg("--pristine-tar")
349+
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
350+
orig_group.add_conf_file_arg("--force-create", action="store_true",
362351
help="force creation of upstream source tarball")
363-
orig_group.add_conf_file_arg("--no-create-orig",
364-
dest="no_create_orig", action="store_true",
352+
orig_group.add_conf_file_arg("--no-create-orig", action="store_true",
365353
help="don't create upstream source tarball")
366-
orig_group.add_conf_file_arg("--tarball-dir",
367-
dest="tarball_dir", type="path",
354+
orig_group.add_conf_file_arg("--tarball-dir", type="path",
368355
help="location to look for external tarballs")
369356
orig_group.add_conf_file_arg("--compression-level",
370357
dest="comp_level",
371358
help="Compression level")
372-
branch_group.add_conf_file_arg("--upstream-branch",
373-
dest="upstream_branch")
374-
branch_group.add_conf_file_arg("--packaging-branch",
375-
dest="packaging_branch")
376-
branch_group.add_bool_conf_file_arg("--ignore-branch",
377-
dest="ignore_branch")
359+
branch_group.add_conf_file_arg("--upstream-branch")
360+
branch_group.add_conf_file_arg("--packaging-branch")
361+
branch_group.add_bool_conf_file_arg("--ignore-branch")
378362
branch_group.add_bool_conf_file_arg("--submodules",
379363
dest="with_submodules")
380-
cmd_group.add_conf_file_arg("--builder", dest="builder",
364+
cmd_group.add_conf_file_arg("--builder",
381365
help="command to build the package")
382-
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
366+
cmd_group.add_conf_file_arg("--cleaner",
383367
help="command to clean the working copy")
384-
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
368+
cmd_group.add_conf_file_arg("--prebuild",
385369
help="command to run before a build")
386370
cmd_group.add_conf_file_arg("--postexport",
387-
dest="postexport",
388371
help="command to run after exporting the source tree")
389-
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
372+
cmd_group.add_conf_file_arg("--postbuild",
390373
help="hook run after a successful build")
391-
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
374+
cmd_group.add_conf_file_arg("--posttag",
392375
help="hook run after a successful tag operation")
393376
cmd_group.add_bool_conf_file_arg("--mock", dest="use_mock")
394377
cmd_group.add_conf_file_arg("--dist", dest="mock_dist")
395378
cmd_group.add_conf_file_arg("--arch", dest="mock_arch")
396-
cmd_group.add_conf_file_arg("--mock-root", dest="mock_root")
397-
cmd_group.add_conf_file_arg("--mock-options", dest="mock_options")
398-
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
379+
cmd_group.add_conf_file_arg("--mock-root")
380+
cmd_group.add_conf_file_arg("--mock-options")
381+
cmd_group.add_bool_conf_file_arg("--hooks")
399382
export_group.add_arg("--no-build", action="store_true",
400-
dest="no_build",
401383
help="Don't run builder or the associated hooks")
402-
export_group.add_conf_file_arg("--export-dir",
403-
dest="export_dir", type="path",
384+
export_group.add_conf_file_arg("--export-dir", type="path",
404385
help="Build topdir, also export the sources under "
405386
"EXPORT_DIR")
406-
export_group.add_conf_file_arg("--export-specdir",
407-
dest="export_specdir", type="path")
408-
export_group.add_conf_file_arg("--export-sourcedir",
409-
dest="export_sourcedir", type="path")
410-
export_group.add_conf_file_arg("--export", dest="export",
411-
metavar="TREEISH",
387+
export_group.add_conf_file_arg("--export-specdir", type="path")
388+
export_group.add_conf_file_arg("--export-sourcedir", type="path")
389+
export_group.add_conf_file_arg("--export", metavar="TREEISH",
412390
help="export treeish object TREEISH")
413-
export_group.add_conf_file_arg("--packaging-dir",
414-
dest="packaging_dir")
415-
export_group.add_conf_file_arg("--spec-file",
416-
dest="spec_file")
417-
export_group.add_conf_file_arg("--spec-vcs-tag", dest="spec_vcs_tag")
391+
export_group.add_conf_file_arg("--packaging-dir")
392+
export_group.add_conf_file_arg("--spec-file")
393+
export_group.add_conf_file_arg("--spec-vcs-tag")
418394
return parser
419395

420396

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)