mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2025-12-12 14:30:09 +01:00
flake8 pacification
This commit is contained in:
parent
20c5f9d103
commit
b036a68a26
1 changed files with 22 additions and 14 deletions
|
|
@ -245,6 +245,18 @@ def _bump(cfg: config.Config, new_version: str, allow_dirty: bool = False) -> No
|
|||
_vcs.push(new_version)
|
||||
|
||||
|
||||
def _try_bump(cfg: config.Config, new_version: str, allow_dirty: bool = False) -> None:
|
||||
try:
|
||||
_bump(cfg, new_version, allow_dirty)
|
||||
except sp.CalledProcessError as ex:
|
||||
log.error(f"Error running subcommand: {ex.cmd}")
|
||||
if ex.stdout:
|
||||
sys.stdout.write(ex.stdout.decode('utf-8'))
|
||||
if ex.stderr:
|
||||
sys.stderr.write(ex.stderr.decode('utf-8'))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _print_diff(cfg: config.Config, new_version: str) -> None:
|
||||
new_vinfo = version.parse_version_info(new_version, cfg.version_pattern)
|
||||
diff: str = rewrite.diff(new_vinfo, cfg.file_patterns)
|
||||
|
|
@ -265,6 +277,14 @@ def _print_diff(cfg: config.Config, new_version: str) -> None:
|
|||
print(diff)
|
||||
|
||||
|
||||
def _try_print_diff(cfg: config.Config, new_version: str) -> None:
|
||||
try:
|
||||
_print_diff(cfg, new_version)
|
||||
except Exception as ex:
|
||||
log.error(str(ex))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("-v", "--verbose", count=True, help="Control log level. -vv for debug level.")
|
||||
@click.option(
|
||||
|
|
@ -338,24 +358,12 @@ def bump(
|
|||
log.info(f"New Version: {new_version}")
|
||||
|
||||
if dry or verbose >= 2:
|
||||
try:
|
||||
_print_diff(cfg, new_version)
|
||||
except Exception as ex:
|
||||
log.error(str(ex))
|
||||
sys.exit(1)
|
||||
_try_print_diff(cfg, new_version)
|
||||
|
||||
if dry:
|
||||
return
|
||||
|
||||
try:
|
||||
_bump(cfg, new_version, allow_dirty)
|
||||
except sp.CalledProcessError as ex:
|
||||
log.error(f"Error running subcommand: {ex.cmd}")
|
||||
if ex.stdout:
|
||||
sys.stdout.write(ex.stdout.decode('utf-8'))
|
||||
if ex.stderr:
|
||||
sys.stderr.write(ex.stderr.decode('utf-8'))
|
||||
sys.exit(1)
|
||||
_try_bump(cfg, new_version, allow_dirty)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue