Skip to content

Commit

Permalink
scripts: drop redundant argparser 'dest' args
Browse files Browse the repository at this point in the history
These are the defaults automatically provided by argparse. This
hopefully slightly improves readability of the code.

Signed-off-by: Markus Lehtonen <[email protected]>
  • Loading branch information
marquiz committed Mar 1, 2018
1 parent b756dfc commit e8ff551
Show file tree
Hide file tree
Showing 15 changed files with 266 additions and 379 deletions.
73 changes: 35 additions & 38 deletions gbp/scripts/buildpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,72 +352,69 @@ def build_parser(name, prefix=None):
export_group = parser.add_argument_group("export build-tree options",
"alternative build tree related options")

parser.add_bool_conf_file_arg("--ignore-new", dest="ignore_new")
parser.add_arg("--verbose", action="store_true", dest="verbose",
parser.add_bool_conf_file_arg("--ignore-new")
parser.add_arg("--verbose", action="store_true",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_conf_file_arg("--notify", dest="notify", type='tristate')
tag_group.add_arg("--tag", action="store_true", dest="tag",
parser.add_conf_file_arg("--color", type='tristate')
parser.add_conf_file_arg("--color-scheme")
parser.add_conf_file_arg("--notify", type='tristate')
tag_group.add_arg("--tag", action="store_true",
help="create a tag after a successful build")
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
tag_group.add_arg("--tag-only", action="store_true",
help="don't build, only tag and run the posttag hook")
tag_group.add_arg("--retag", action="store_true", dest="retag",
tag_group.add_arg("--retag", action="store_true",
help="don't fail if the tag already exists")
tag_group.add_bool_conf_file_arg("--sign-tags", dest="sign_tags")
tag_group.add_conf_file_arg("--keyid", dest="keyid")
tag_group.add_conf_file_arg("--debian-tag", dest="debian_tag")
tag_group.add_conf_file_arg("--debian-tag-msg", dest="debian_tag_msg")
tag_group.add_conf_file_arg("--upstream-tag", dest="upstream_tag")
orig_group.add_conf_file_arg("--upstream-tree", dest="upstream_tree")
orig_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar")
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
dest="pristine_tar_commit")
orig_group.add_conf_file_arg("--force-create", dest="force_create",
tag_group.add_bool_conf_file_arg("--sign-tags")
tag_group.add_conf_file_arg("--keyid")
tag_group.add_conf_file_arg("--debian-tag")
tag_group.add_conf_file_arg("--debian-tag-msg")
tag_group.add_conf_file_arg("--upstream-tag")
orig_group.add_conf_file_arg("--upstream-tree")
orig_group.add_bool_conf_file_arg("--pristine-tar")
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
orig_group.add_conf_file_arg("--force-create",
help="force creation of orig tarball", action="store_true")
orig_group.add_conf_file_arg("--no-create-orig", dest="no_create_orig",
orig_group.add_conf_file_arg("--no-create-orig",
help="don't create orig tarball", action="store_true")
orig_group.add_conf_file_arg("--tarball-dir", dest="tarball_dir", type="path",
orig_group.add_conf_file_arg("--tarball-dir", type="path",
help="location to look for external tarballs")
orig_group.add_conf_file_arg("--compression", dest="comp_type",
help="Compression type")
orig_group.add_conf_file_arg("--compression-level", dest="comp_level",
help="Compression level")
orig_group.add_conf_file_arg("--component", action="append", metavar='COMPONENT',
dest="components")
branch_group.add_conf_file_arg("--upstream-branch", dest="upstream_branch")
branch_group.add_conf_file_arg("--debian-branch", dest="debian_branch")
branch_group.add_bool_conf_file_arg("--ignore-branch", dest="ignore_branch")
branch_group.add_conf_file_arg("--upstream-branch")
branch_group.add_conf_file_arg("--debian-branch")
branch_group.add_bool_conf_file_arg("--ignore-branch")
branch_group.add_bool_conf_file_arg("--submodules", dest="with_submodules")
cmd_group.add_conf_file_arg("--builder", dest="builder",
cmd_group.add_conf_file_arg("--builder",
help="command to build the Debian package")
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
cmd_group.add_conf_file_arg("--cleaner",
help="command to clean the working copy")
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
cmd_group.add_conf_file_arg("--prebuild",
help="hook to run before a build")
cmd_group.add_conf_file_arg("--postexport", dest="postexport",
cmd_group.add_conf_file_arg("--postexport",
help="hook to run after exporting the source tree")
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
cmd_group.add_conf_file_arg("--postbuild",
help="hook run after a successful build")
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
cmd_group.add_conf_file_arg("--posttag",
help="hook run after a successful tag operation")
cmd_group.add_bool_conf_file_arg("--pbuilder", dest="use_pbuilder")
cmd_group.add_bool_conf_file_arg("--qemubuilder", dest="use_qemubuilder")
cmd_group.add_conf_file_arg("--dist", dest="pbuilder_dist")
cmd_group.add_conf_file_arg("--arch", dest="pbuilder_arch")
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf",
dest="pbuilder_autoconf")
cmd_group.add_conf_file_arg("--pbuilder-options", dest="pbuilder_options")
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
export_group.add_conf_file_arg("--export-dir", dest="export_dir", type="path",
cmd_group.add_bool_conf_file_arg("--pbuilder-autoconf")
cmd_group.add_conf_file_arg("--pbuilder-options")
cmd_group.add_bool_conf_file_arg("--hooks")
export_group.add_conf_file_arg("--export-dir", type="path",
help="before building the package export "
"the source into EXPORT_DIR")
export_group.add_conf_file_arg("--export", dest="export",
export_group.add_conf_file_arg("--export",
help="export treeish object TREEISH",
metavar="TREEISH")
export_group.add_bool_conf_file_arg("--purge", dest="purge")
export_group.add_bool_conf_file_arg("--overlay", dest="overlay")
export_group.add_bool_conf_file_arg("--purge")
export_group.add_bool_conf_file_arg("--overlay")
return parser


Expand Down
104 changes: 40 additions & 64 deletions gbp/scripts/buildpackage_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,100 +321,76 @@ def build_parser(name, prefix=None, git_treeish=None):
export_group = parser.add_argument_group("export build-tree options",
"alternative build tree related options")

parser.add_bool_conf_file_arg("--ignore-new",
dest="ignore_new")
parser.add_arg("--verbose", action="store_true", dest="verbose",
parser.add_bool_conf_file_arg("--ignore-new")
parser.add_arg("--verbose", action="store_true",
help="verbose command execution")
parser.add_conf_file_arg("--tmp-dir", dest="tmp_dir")
parser.add_conf_file_arg("--color", dest="color",
parser.add_conf_file_arg("--tmp-dir")
parser.add_conf_file_arg("--color",
type='tristate')
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_conf_file_arg("--notify", dest="notify",
parser.add_conf_file_arg("--color-scheme")
parser.add_conf_file_arg("--notify",
type='tristate')
parser.add_conf_file_arg("--vendor", action="store",
dest="vendor")
parser.add_conf_file_arg("--native", dest="native",
parser.add_conf_file_arg("--vendor", action="store")
parser.add_conf_file_arg("--native",
type='tristate')
tag_group.add_arg("--tag", action="store_true", dest="tag",
tag_group.add_arg("--tag", action="store_true",
help="create a tag after a successful build")
tag_group.add_arg("--tag-only", action="store_true", dest="tag_only",
tag_group.add_arg("--tag-only", action="store_true",
help="don't build, only tag and run the posttag hook")
tag_group.add_arg("--retag", action="store_true", dest="retag",
tag_group.add_arg("--retag", action="store_true",
help="don't fail if the tag already exists")
tag_group.add_bool_conf_file_arg("--sign-tags",
dest="sign_tags")
tag_group.add_conf_file_arg("--keyid", dest="keyid")
tag_group.add_conf_file_arg("--packaging-tag",
dest="packaging_tag")
tag_group.add_conf_file_arg("--packaging-tag-msg",
dest="packaging_tag_msg")
tag_group.add_conf_file_arg("--upstream-tag",
dest="upstream_tag")
orig_group.add_conf_file_arg("--upstream-tree",
dest="upstream_tree")
orig_group.add_bool_conf_file_arg("--pristine-tar",
dest="pristine_tar")
orig_group.add_bool_conf_file_arg("--pristine-tar-commit",
dest="pristine_tar_commit")
orig_group.add_conf_file_arg("--force-create",
dest="force_create", action="store_true",
tag_group.add_bool_conf_file_arg("--sign-tags")
tag_group.add_conf_file_arg("--keyid")
tag_group.add_conf_file_arg("--packaging-tag")
tag_group.add_conf_file_arg("--packaging-tag-msg")
tag_group.add_conf_file_arg("--upstream-tag")
orig_group.add_conf_file_arg("--upstream-tree")
orig_group.add_bool_conf_file_arg("--pristine-tar")
orig_group.add_bool_conf_file_arg("--pristine-tar-commit")
orig_group.add_conf_file_arg("--force-create", action="store_true",
help="force creation of upstream source tarball")
orig_group.add_conf_file_arg("--no-create-orig",
dest="no_create_orig", action="store_true",
orig_group.add_conf_file_arg("--no-create-orig", action="store_true",
help="don't create upstream source tarball")
orig_group.add_conf_file_arg("--tarball-dir",
dest="tarball_dir", type="path",
orig_group.add_conf_file_arg("--tarball-dir", type="path",
help="location to look for external tarballs")
orig_group.add_conf_file_arg("--compression-level",
dest="comp_level",
help="Compression level")
branch_group.add_conf_file_arg("--upstream-branch",
dest="upstream_branch")
branch_group.add_conf_file_arg("--packaging-branch",
dest="packaging_branch")
branch_group.add_bool_conf_file_arg("--ignore-branch",
dest="ignore_branch")
branch_group.add_conf_file_arg("--upstream-branch")
branch_group.add_conf_file_arg("--packaging-branch")
branch_group.add_bool_conf_file_arg("--ignore-branch")
branch_group.add_bool_conf_file_arg("--submodules",
dest="with_submodules")
cmd_group.add_conf_file_arg("--builder", dest="builder",
cmd_group.add_conf_file_arg("--builder",
help="command to build the package")
cmd_group.add_conf_file_arg("--cleaner", dest="cleaner",
cmd_group.add_conf_file_arg("--cleaner",
help="command to clean the working copy")
cmd_group.add_conf_file_arg("--prebuild", dest="prebuild",
cmd_group.add_conf_file_arg("--prebuild",
help="command to run before a build")
cmd_group.add_conf_file_arg("--postexport",
dest="postexport",
help="command to run after exporting the source tree")
cmd_group.add_conf_file_arg("--postbuild", dest="postbuild",
cmd_group.add_conf_file_arg("--postbuild",
help="hook run after a successful build")
cmd_group.add_conf_file_arg("--posttag", dest="posttag",
cmd_group.add_conf_file_arg("--posttag",
help="hook run after a successful tag operation")
cmd_group.add_bool_conf_file_arg("--mock", dest="use_mock")
cmd_group.add_conf_file_arg("--dist", dest="mock_dist")
cmd_group.add_conf_file_arg("--arch", dest="mock_arch")
cmd_group.add_conf_file_arg("--mock-root", dest="mock_root")
cmd_group.add_conf_file_arg("--mock-options", dest="mock_options")
cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks")
cmd_group.add_conf_file_arg("--mock-root")
cmd_group.add_conf_file_arg("--mock-options")
cmd_group.add_bool_conf_file_arg("--hooks")
export_group.add_arg("--no-build", action="store_true",
dest="no_build",
help="Don't run builder or the associated hooks")
export_group.add_conf_file_arg("--export-dir",
dest="export_dir", type="path",
export_group.add_conf_file_arg("--export-dir", type="path",
help="Build topdir, also export the sources under "
"EXPORT_DIR")
export_group.add_conf_file_arg("--export-specdir",
dest="export_specdir", type="path")
export_group.add_conf_file_arg("--export-sourcedir",
dest="export_sourcedir", type="path")
export_group.add_conf_file_arg("--export", dest="export",
metavar="TREEISH",
export_group.add_conf_file_arg("--export-specdir", type="path")
export_group.add_conf_file_arg("--export-sourcedir", type="path")
export_group.add_conf_file_arg("--export", metavar="TREEISH",
help="export treeish object TREEISH")
export_group.add_conf_file_arg("--packaging-dir",
dest="packaging_dir")
export_group.add_conf_file_arg("--spec-file",
dest="spec_file")
export_group.add_conf_file_arg("--spec-vcs-tag", dest="spec_vcs_tag")
export_group.add_conf_file_arg("--packaging-dir")
export_group.add_conf_file_arg("--spec-file")
export_group.add_conf_file_arg("--spec-vcs-tag")
return parser


Expand Down
28 changes: 13 additions & 15 deletions gbp/scripts/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,25 @@ def build_parser(name):
branch_group = parser.add_argument_group("branch options", "branch tracking and layout options")
cmd_group = parser.add_argument_group("external command options", "how and when to invoke hooks")

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

parser.add_arg("-v", "--verbose", action="store_true", dest="verbose",
parser.add_arg("-v", "--verbose", action="store_true",
help="verbose command execution")
parser.add_conf_file_arg("--color", dest="color", type='tristate')
parser.add_conf_file_arg("--color-scheme", dest="color_scheme")
parser.add_conf_file_arg("--repo-user", dest="repo_user",
choices=['DEBIAN', 'GIT'])
parser.add_conf_file_arg("--repo-email", dest="repo_email",
choices=['DEBIAN', 'GIT'])
parser.add_conf_file_arg("--color", type='tristate')
parser.add_conf_file_arg("--color-scheme")
parser.add_conf_file_arg("--repo-user", choices=['DEBIAN', 'GIT'])
parser.add_conf_file_arg("--repo-email", choices=['DEBIAN', 'GIT'])
parser.add_argument("repository", metavar="REPOSITORY",
help="repository to clone")
parser.add_argument("directory", metavar="DIRECTORY", nargs="?",
Expand Down
26 changes: 8 additions & 18 deletions gbp/scripts/create_remote_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,33 +232,23 @@ def build_parser(name, sections=[]):
"branch layout and tracking options")
branch_group.add_conf_file_arg("--remote-url-pattern",
dest="remote_url")
branch_group.add_conf_file_arg("--upstream-branch",
dest="upstream_branch")
branch_group.add_conf_file_arg("--debian-branch",
dest="debian_branch")
branch_group.add_bool_conf_file_arg("--pristine-tar",
dest="pristine_tar")
branch_group.add_bool_conf_file_arg("--track",
dest='track')
branch_group.add_bool_conf_file_arg("--bare",
dest='bare')
branch_group.add_conf_file_arg("--upstream-branch")
branch_group.add_conf_file_arg("--debian-branch")
branch_group.add_bool_conf_file_arg("--pristine-tar")
branch_group.add_bool_conf_file_arg("--track")
branch_group.add_bool_conf_file_arg("--bare")
parser.add_arg("-v", "--verbose",
action="store_true",
dest="verbose",
help="verbose command execution")
parser.add_conf_file_arg("--color",
dest="color",
type='tristate')
parser.add_conf_file_arg("--color-scheme",
dest="color_scheme")
parser.add_conf_file_arg("--color-scheme")
parser.add_arg("--remote-name",
dest="name",
default="origin",
help="The name of the remote, default is 'origin'")
parser.add_conf_file_arg("--template-dir",
dest="template_dir")
parser.add_conf_file_arg("--remote-config",
dest="remote_config")
parser.add_conf_file_arg("--template-dir")
parser.add_conf_file_arg("--remote-config")
parser.add_argument("action", metavar="ACTION", nargs="?",
default="create", choices=('create', 'list'),
help="action to take")
Expand Down
Loading

0 comments on commit e8ff551

Please sign in to comment.