functions: log the version without the extra letter
This commit is contained in:
@@ -58,22 +58,25 @@ except Exception as e:
|
||||
|
||||
|
||||
def get_software_version():
|
||||
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
|
||||
'--tags', '--long', '--dirty')
|
||||
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always', '--tags', '--long', '--dirty')
|
||||
try:
|
||||
process = subprocess.Popen(prog, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
process = subprocess.Popen(prog, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
ver, err = process.communicate()
|
||||
retcode = process.wait()
|
||||
if retcode == 0:
|
||||
version = ver.strip()
|
||||
if isinstance(version, bytes):
|
||||
version = version.decode()
|
||||
# Remove the 'g' at the start of the hash
|
||||
parts = version.split('-')
|
||||
if len(parts) > 2 and parts[-2].startswith('g'):
|
||||
parts[-2] = parts[-2][1:] # Remove the 'g'
|
||||
version = '-'.join(parts)
|
||||
return version
|
||||
else:
|
||||
logging.debug(f"Error getting git version: {err}")
|
||||
except OSError:
|
||||
logging.exception("Error runing git describe")
|
||||
logging.exception("Error running git describe")
|
||||
return "?"
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user