Skip to content

Commit

Permalink
Run 'git tag' with run_this_posix_command()
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 11, 2023
1 parent 741a8ef commit b0b0b08
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions dev_tools/git_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"""

# nosec - Ignore security warnings
from subprocess import Popen, PIPE, STDOUT # nosec
from subprocess import run, Popen, PIPE, STDOUT # nosec
from argparse import ArgumentParser
import fileinput
import shlex
import sys
import os
import re

from ciscoconfparse.ccp_util import run_this_posix_command
from loguru import logger as loguru_logger

# Prevent stddout / stderr buffering issues...
Expand Down Expand Up @@ -311,14 +312,16 @@ def check_exists_tag_local(tag_value=None):
tag_value
),
)
stdout, stderr = run_cmd("git tag")

cmd = "git tag"
return_code, stdout, stderr = run_this_posix_command(cmd)

for line in stdout.splitlines():
if tag_value.strip() == line.strip():
loguru_logger.log(
"DEBUG", "|" + "Tag '{}' already exists.".format(tag_value)
)
loguru_logger.error(f"Tag '{tag_value}' already exists.")
return True
loguru_logger.log("DEBUG", "|" + "'{}' is a new git tag".format(tag_value))

loguru_logger.info(f"'{tag_value}' is a new git tag")
return False


Expand Down Expand Up @@ -503,8 +506,9 @@ def git_tag_commit_version():
"""
Tag the latest git commit with the version listed in pyproject.toml
"""
project_version_tag = get_pyproject_version()
stdout, stderr = run_cmd(
'git tag -a {0} -m "Tag with {0}"'.format(get_pyproject_version())
f'git tag -a {project_version_tag} -m "Tag with {project_version_tag}"'
)


Expand Down

0 comments on commit b0b0b08

Please sign in to comment.