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
parent 795e46cedd
commit 17751ad283

View File

@ -10,6 +10,7 @@ import subprocess
import sys import sys
import sh import sh
import base64 import base64
from io import StringIO
from datetime import date from datetime import date
from sh.contrib import git from sh.contrib import git
@ -58,9 +59,13 @@ def get_languages(list_all=False):
def get_version_info(): def get_version_info():
version = None 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: 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: except sh.ErrorReturnCode_128:
# No exact match # No exact match
pass pass