Update build_board_info.py to sh module 2.0.0

This commit is contained in:
Neradoc 2023-02-10 04:58:37 +01:00 committed by Jeff Epler
parent 0d957fe15c
commit cec36b62f1
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -10,6 +10,7 @@ import subprocess
import sys
import sh
import base64
from io import StringIO
from datetime import date
from sh.contrib import git
@ -58,9 +59,13 @@ def get_languages(list_all=False):
def get_version_info():
version = None
sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8")
buffer = StringIO()
git("rev-parse", "--short", "HEAD", _out=buffer)
sha = buffer.getvalue().strip()
try:
version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip()
buffer = StringIO()
git("describe", "--tags", "--exact-match", _out=buffer)
version = buffer.getvalue().strip()
except sh.ErrorReturnCode_128:
# No exact match
pass