From 91230d4ebabe82bcc0e51b4f96bc2f6bc49376df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 3 Jul 2022 16:02:21 +0200 Subject: [PATCH] Invert negative arguments in --help parsing "Negative logic" is harder to follow. We may define only a negative option for users, but we should still convert it to a normal boolean internally. --- rust2rpm/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index 6867ab5..e4738e1 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -367,9 +367,11 @@ def main(): help="Print license mappings and exit") parser.add_argument("--translate-license", action="store_true", help="Print mapping for specified license and exit") - parser.add_argument("--no-auto-changelog-entry", action="store_true", + parser.add_argument("--no-auto-changelog-entry", action="store_false", + default=True, dest="auto_changelog_entry", help="Do not generate a changelog entry") - parser.add_argument("--no-existence-check", action="store_true", + parser.add_argument("--no-existence-check", action="store_false", + default=True, dest="existence_check", help="Do not check whether the package already exists in dist-git") parser.add_argument("-", "--stdout", action="store_true", help="Print spec and patches into stdout") @@ -459,7 +461,7 @@ def main(): kwargs["pkg_suffix"] = suffix spec_file = pathlib.Path(f"rust-{metadata.name}{suffix}.spec") - if args.target in {"fedora"} and not args.no_existence_check and not os.path.exists(spec_file): + if args.target in {"fedora"} and args.existence_check and not os.path.exists(spec_file): # No specfile, so this is probably a new package package_info = get_package_info(f"rust-{metadata.name}{suffix}") if package_info: @@ -467,7 +469,7 @@ def main(): print("Re-run with --no-existence-check if you still want to convert it.") sys.exit(1) - kwargs["auto_changelog_entry"] = not args.no_auto_changelog_entry + kwargs["auto_changelog_entry"] = args.auto_changelog_entry rpmautospec = args.rpmautospec if rpmautospec is None: