From b756dfc5a02cf8721947a1a826d246f065e10a26 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 15 Jan 2018 11:32:45 +0200 Subject: [PATCH] scripts: drop redundant argparser 'default' args There is no need to provide a default when 'store_true' or 'store_false' action is used. Signed-off-by: Markus Lehtonen --- gbp/scripts/buildpackage.py | 8 ++++---- gbp/scripts/buildpackage_rpm.py | 6 ++---- gbp/scripts/clone.py | 4 ++-- gbp/scripts/create_remote_repo.py | 1 - gbp/scripts/dch.py | 22 +++++++++++----------- gbp/scripts/export_orig.py | 2 +- gbp/scripts/import_dsc.py | 8 ++++---- gbp/scripts/import_orig.py | 4 ++-- gbp/scripts/import_srpm.py | 11 +++++------ gbp/scripts/pq.py | 4 ++-- gbp/scripts/pq_rpm.py | 3 +-- gbp/scripts/pristine_tar.py | 2 +- gbp/scripts/push.py | 4 ++-- gbp/scripts/rpm_ch.py | 2 +- gbp/scripts/tag.py | 4 ++-- 15 files changed, 40 insertions(+), 45 deletions(-) diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index e2e4e163..a84c9e50 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -353,17 +353,17 @@ def build_parser(name, prefix=None): "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", default=False, + parser.add_arg("--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("--notify", dest="notify", type='tristate') - tag_group.add_arg("--tag", action="store_true", dest="tag", default=False, + tag_group.add_arg("--tag", action="store_true", dest="tag", help="create a tag after a successful build") - tag_group.add_arg("--tag-only", action="store_true", dest="tag_only", default=False, + tag_group.add_arg("--tag-only", action="store_true", dest="tag_only", help="don't build, only tag and run the posttag hook") - tag_group.add_arg("--retag", action="store_true", dest="retag", default=False, + tag_group.add_arg("--retag", action="store_true", dest="retag", 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") diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 06fcd84d..70f4e217 100644 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -324,7 +324,7 @@ def build_parser(name, prefix=None, git_treeish=None): parser.add_bool_conf_file_arg("--ignore-new", dest="ignore_new") parser.add_arg("--verbose", action="store_true", dest="verbose", - default=False, help="verbose command execution") + help="verbose command execution") parser.add_conf_file_arg("--tmp-dir", dest="tmp_dir") parser.add_conf_file_arg("--color", dest="color", type='tristate') @@ -337,13 +337,11 @@ def build_parser(name, prefix=None, git_treeish=None): parser.add_conf_file_arg("--native", dest="native", type='tristate') tag_group.add_arg("--tag", action="store_true", dest="tag", - default=False, help="create a tag after a successful build") tag_group.add_arg("--tag-only", action="store_true", dest="tag_only", - default=False, help="don't build, only tag and run the posttag hook") tag_group.add_arg("--retag", action="store_true", dest="retag", - default=False, help="don't fail if the tag already exists") + 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") diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py index 287129e4..ee4baf12 100755 --- a/gbp/scripts/clone.py +++ b/gbp/scripts/clone.py @@ -109,7 +109,7 @@ 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", default=False, + branch_group.add_arg("--all", action="store_true", dest="all", 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") @@ -122,7 +122,7 @@ def build_parser(name): help="hook to run after cloning the source tree") cmd_group.add_bool_conf_file_arg("--hooks", dest="hooks") - parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + 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") diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py index 0fd5cd14..40100f15 100644 --- a/gbp/scripts/create_remote_repo.py +++ b/gbp/scripts/create_remote_repo.py @@ -245,7 +245,6 @@ def build_parser(name, sections=[]): parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", - default=False, help="verbose command execution") parser.add_conf_file_arg("--color", dest="color", diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py index a6876965..6ab86551 100644 --- a/gbp/scripts/dch.py +++ b/gbp/scripts/dch.py @@ -352,36 +352,36 @@ def build_parser(name): help="expression to determine the next snapshot number") parser.add_conf_file_arg("--git-log", dest="git_log", help="options to pass to git-log") - parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + 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") range_group.add_arg("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, debian/0.4.3)") - range_group.add_arg("-a", "--auto", action="store_true", dest="auto", default=False, + range_group.add_arg("-a", "--auto", action="store_true", dest="auto", help="autocomplete changelog from last snapshot or tag") - version_group.add_arg("-R", "--release", action="store_true", dest="release", default=False, + version_group.add_arg("-R", "--release", action="store_true", dest="release", help="mark as release") - version_group.add_arg("-S", "--snapshot", action="store_true", dest="snapshot", default=False, + version_group.add_arg("-S", "--snapshot", action="store_true", dest="snapshot", help="mark as snapshot build") version_group.add_arg("-D", "--distribution", dest="distribution", help="Set distribution") - version_group.add_arg("--force-distribution", action="store_true", dest="force_distribution", default=False, + version_group.add_arg("--force-distribution", action="store_true", dest="force_distribution", help="Force the provided distribution to be used, " "even if it doesn't match the list of known distributions") version_group.add_arg("-N", "--new-version", dest="new_version", help="use this as base for the new version number") version_group.add_conf_file_arg("--urgency", dest="urgency") - version_group.add_arg("--bpo", dest="bpo", action="store_true", default=False, + version_group.add_arg("--bpo", dest="bpo", action="store_true", help="Increment the Debian release number for an upload to backports, " "and add a backport upload changelog comment.") - version_group.add_arg("--nmu", dest="nmu", action="store_true", default=False, + version_group.add_arg("--nmu", dest="nmu", action="store_true", help="Increment the Debian release number for a non-maintainer upload") - version_group.add_arg("--qa", dest="qa", action="store_true", default=False, + version_group.add_arg("--qa", dest="qa", action="store_true", help="Increment the Debian release number for a Debian QA Team upload, " "and add a QA upload changelog comment.") - version_group.add_arg("--team", dest="team", action="store_true", default=False, + version_group.add_arg("--team", dest="team", action="store_true", help="Increment the Debian release number for a Debian Team upload, " "and add a Team upload changelog comment.") - version_group.add_arg("--security", dest="security", action="store_true", default=False, + version_group.add_arg("--security", dest="security", action="store_true", help="Increment the Debian release number for a security upload and " "add a security upload changelog comment.") version_group.add_bool_conf_file_arg("--git-author", dest="use_git_author") @@ -399,7 +399,7 @@ def build_parser(name): commit_group.add_conf_file_arg("--spawn-editor", dest="spawn_editor") parser.add_conf_file_arg("--commit-msg", dest="commit_msg") - parser.add_arg("-c", "--commit", action="store_true", dest="commit", default=False, + parser.add_arg("-c", "--commit", action="store_true", dest="commit", help="commit changelog file after generating") parser.add_conf_file_arg("--dch-opt", dest="dch_opts", action="append", help="option to pass to dch verbatim, " diff --git a/gbp/scripts/export_orig.py b/gbp/scripts/export_orig.py index 2933ee15..f5dc98ac 100755 --- a/gbp/scripts/export_orig.py +++ b/gbp/scripts/export_orig.py @@ -276,7 +276,7 @@ def build_parser(name): branch_group = parser.add_argument_group("branch options", "branch layout options") - parser.add_arg("--verbose", action="store_true", dest="verbose", default=False, + parser.add_arg("--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", diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py index 8a04e42b..d9f68b2a 100644 --- a/gbp/scripts/import_dsc.py +++ b/gbp/scripts/import_dsc.py @@ -320,7 +320,7 @@ def build_parser(name): branch_group = parser.add_argument_group("version and branch naming options", "version number and branch layout options") - parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + 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", @@ -341,7 +341,7 @@ def build_parser(name): tag_group.add_conf_file_arg("--upstream-tag", dest="upstream_tag") tag_group.add_arg("--skip-debian-tag", dest="skip_debian_tag", - action="store_true", default=False, + action="store_true", help="Don't add a tag after importing the Debian patch") import_group.add_conf_file_arg("--filter", @@ -349,7 +349,7 @@ def build_parser(name): import_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar") import_group.add_arg("--allow-same-version", action="store_true", - dest="allow_same_version", default=False, + dest="allow_same_version", help="allow import of already imported version") import_group.add_bool_conf_file_arg("--author-is-committer", dest="author_committer") @@ -363,7 +363,7 @@ def build_parser(name): parser.add_conf_file_arg("--repo-email", dest="repo_email", choices=['DEBIAN', 'GIT']) parser.add_arg("--download", dest='download', action="store_true", - default=False, help="Ignored. Accepted for compatibility.") + help="Ignored. Accepted for compatibility.") parser.add_argument("package", metavar="PACKAGE", help="package to import") parser.add_argument("target_dir", metavar="TARGET_DIR", nargs="?", diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py index d217a4be..2770434d 100644 --- a/gbp/scripts/import_orig.py +++ b/gbp/scripts/import_orig.py @@ -349,7 +349,7 @@ def build_parser(name): dest='interactive') parser.add_bool_conf_file_arg("--rollback", dest="rollback") - parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + 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", @@ -357,7 +357,7 @@ def build_parser(name): # Accepted for compatibility parser.add_arg("--download", dest='download', action="store_true", - default=False, help="Ignored. Accepted for compatibility.") + help="Ignored. Accepted for compatibility.") src_group = parser.add_mutually_exclusive_group(required=True) src_group.add_arg("--uscan", action="store_true", diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index c02b8586..0e166e54 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -134,7 +134,7 @@ def build_parser(name): "version number and branch layout options") parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", - default=False, help="verbose command execution") + help="verbose command execution") parser.add_conf_file_arg("--color", dest="color", type='tristate') parser.add_conf_file_arg("--color-scheme", @@ -143,7 +143,7 @@ def build_parser(name): parser.add_conf_file_arg("--vendor", action="store", dest="vendor") parser.add_arg("--download", action="store_true", dest="download", - default=False, help="download source package") + help="download source package") branch_group.add_conf_file_arg("--packaging-branch", dest="packaging_branch") branch_group.add_conf_file_arg("--upstream-branch", @@ -154,10 +154,9 @@ def build_parser(name): branch_group.add_bool_conf_file_arg("--create-missing-branches", dest="create_missing_branches") branch_group.add_arg("--orphan-packaging", action="store_true", - dest="orphan_packaging", default=False, + dest="orphan_packaging", help="The packaging branch doesn't base on upstream") - branch_group.add_arg("--native", action="store_true", - dest="native", default=False, + branch_group.add_arg("--native", action="store_true", dest="native", help="This is a dist native package, no separate " "upstream branch") @@ -178,7 +177,7 @@ def build_parser(name): import_group.add_bool_conf_file_arg("--pristine-tar", dest="pristine_tar") import_group.add_arg("--allow-same-version", action="store_true", - dest="allow_same_version", default=False, + dest="allow_same_version", help="allow import of already imported version") import_group.add_bool_conf_file_arg("--author-is-committer", dest="author_is_committer") diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py index 21f8a468..59dad643 100755 --- a/gbp/scripts/pq.py +++ b/gbp/scripts/pq.py @@ -412,14 +412,14 @@ def build_parser(name): return None # Add common arguments - _parent.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + _parent.add_arg("-v", "--verbose", action="store_true", dest="verbose", help="verbose command execution") _parent.add_conf_file_arg("--color", dest="color", type='tristate') _parent.add_conf_file_arg("--color-scheme", dest="color_scheme") _parent.add_conf_file_arg("--pq-from", dest="pq_from", choices=['DEBIAN', 'TAG']) _parent.add_conf_file_arg("--upstream-tag", dest="upstream_tag") - _parent.add_arg("--force", dest="force", action="store_true", default=False, + _parent.add_arg("--force", dest="force", action="store_true", help="in case of import even import if the branch already exists") _parent.add_conf_file_arg("--time-machine", dest="time_machine", type=int) diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index 089add74..71ae3605 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -381,7 +381,7 @@ def build_parser(name): # Add common arguments _parent.add_arg("-v", "--verbose", action="store_true", dest="verbose", - default=False, help="Verbose command execution") + help="Verbose command execution") _parent.add_conf_file_arg("--color", dest="color", type='tristate') _parent.add_conf_file_arg("--color-scheme", @@ -410,7 +410,6 @@ def build_parser(name): help="Create a patch queue / devel branch from spec file " "and patches in current dir.") _parser.add_arg("--force", dest="force", action="store_true", - default=False, help="In case of import even import if the branch already exists") # Rebase _parser = subparsers.add_parser('rebase', parents=[_parent], diff --git a/gbp/scripts/pristine_tar.py b/gbp/scripts/pristine_tar.py index 80de1d66..d313b714 100644 --- a/gbp/scripts/pristine_tar.py +++ b/gbp/scripts/pristine_tar.py @@ -53,7 +53,7 @@ def build_parser(name): dest="upstream_tag") parser.add_conf_file_arg("--component", action="append", metavar='COMPONENT', dest="components") - parser.add_arg("-v", "--verbose", action="store_true", dest="verbose", default=False, + 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", diff --git a/gbp/scripts/push.py b/gbp/scripts/push.py index 6cc3c71f..b6a1bdb2 100755 --- a/gbp/scripts/push.py +++ b/gbp/scripts/push.py @@ -36,7 +36,7 @@ def build_parser(name): gbp.log.err(err) return None - parser.add_arg("-d", "--dry-run", dest="dryrun", default=False, + parser.add_arg("-d", "--dry-run", dest="dryrun", action="store_true", help="dry run, don't push.") parser.add_conf_file_arg("--upstream-branch", dest="upstream_branch") @@ -53,7 +53,7 @@ def build_parser(name): parser.add_conf_file_arg("--color-scheme", dest="color_scheme") parser.add_arg("--verbose", action="store_true", dest="verbose", - default=False, help="verbose command execution") + help="verbose command execution") parser.add_argument("remote", metavar="REMOTE", nargs="?", help="remote where to push") return parser diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index 77677814..f3306fd4 100644 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -356,7 +356,7 @@ def build_parser(name): range_grp.add_arg("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, release/0.1.2)") # Formatting group options - format_grp.add_arg("--no-release", action="store_false", default=True, + format_grp.add_arg("--no-release", action="store_false", dest="release", help="no release, just update the last changelog section") format_grp.add_bool_conf_file_arg("--git-author", diff --git a/gbp/scripts/tag.py b/gbp/scripts/tag.py index 7a0ef3cd..adf2e81a 100755 --- a/gbp/scripts/tag.py +++ b/gbp/scripts/tag.py @@ -85,7 +85,7 @@ def build_parser(name): gbp.log.err(err) return None - parser.add_arg("--retag", action="store_true", dest="retag", default=False, + parser.add_arg("--retag", action="store_true", dest="retag", help="don't fail if the tag already exists") parser.add_conf_file_arg("--debian-branch", dest="debian_branch") @@ -102,7 +102,7 @@ def build_parser(name): parser.add_conf_file_arg("--color-scheme", dest="color_scheme") parser.add_arg("--verbose", action="store_true", dest="verbose", - default=False, help="verbose command execution") + help="verbose command execution") return parser