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():
|
def get_software_version():
|
||||||
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
|
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always', '--tags', '--long', '--dirty')
|
||||||
'--tags', '--long', '--dirty')
|
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(prog, stdout=subprocess.PIPE,
|
process = subprocess.Popen(prog, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stderr=subprocess.PIPE)
|
|
||||||
ver, err = process.communicate()
|
ver, err = process.communicate()
|
||||||
retcode = process.wait()
|
retcode = process.wait()
|
||||||
if retcode == 0:
|
if retcode == 0:
|
||||||
version = ver.strip()
|
version = ver.strip()
|
||||||
if isinstance(version, bytes):
|
if isinstance(version, bytes):
|
||||||
version = version.decode()
|
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
|
return version
|
||||||
else:
|
else:
|
||||||
logging.debug(f"Error getting git version: {err}")
|
logging.debug(f"Error getting git version: {err}")
|
||||||
except OSError:
|
except OSError:
|
||||||
logging.exception("Error runing git describe")
|
logging.exception("Error running git describe")
|
||||||
return "?"
|
return "?"
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user