diff --git a/CHANGELOG.md b/CHANGELOG.md index 017d18c..66e60d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.19.4 - 2024-12-24 + +- fixed minor issues on Python 3.8 + ## v0.19.3 - 2024-11-11 - fixed crash with nested C-style enums without a name (#39) (@tim-janik) diff --git a/src/poxy/main.py b/src/poxy/main.py index 4394ee6..545e6d3 100644 --- a/src/poxy/main.py +++ b/src/poxy/main.py @@ -58,19 +58,21 @@ def _invoker(func, **kwargs): sys.exit(0) -def make_boolean_optional_arg(args, name, default, help='', **kwargs): +def make_boolean_optional_arg(args: argparse.ArgumentParser, name: str, default, help='', **kwargs): + name = name.strip().lstrip('-') if sys.version_info >= (3, 9): args.add_argument(rf'--{name}', default=default, help=help, action=argparse.BooleanOptionalAction, **kwargs) else: - args.add_argument(rf'--{name}', action=r'store_true', help=help, **kwargs) + dest = name.replace(r'-', r'_') + args.add_argument(rf'--{name}', action=r'store_true', help=help, dest=dest, default=default, **kwargs) args.add_argument( rf'--no-{name}', action=r'store_false', help=(help if help == argparse.SUPPRESS else None), - dest=name, + dest=dest, + default=default, **kwargs, ) - args.set_defaults(**{name: default}) def git(git_args: str, cwd=None) -> typing.Tuple[int, str, str]: @@ -124,7 +126,8 @@ def multi_version_git_tags(args: argparse.Namespace): original_branch = current_branch default_branch = git_failed_if_nonzero(git('rev-parse --abbrev-ref origin/HEAD', cwd=input_dir))[1] - default_branch = default_branch.removeprefix(r'origin/') + if default_branch.startswith(r'origin/'): + default_branch = default_branch[len(r'origin/') :] print(rf'Default branch: {default_branch}') tags = git_failed_if_nonzero(git('tag', cwd=input_dir))[1].splitlines() diff --git a/src/poxy/version.txt b/src/poxy/version.txt index b72b05e..c0b8d59 100644 --- a/src/poxy/version.txt +++ b/src/poxy/version.txt @@ -1 +1 @@ -0.19.3 +0.19.4