Skip to content

Commit

Permalink
fix(tools): Avoid crashing when Git is used to acquire IDF version
Browse files Browse the repository at this point in the history
Closes #13345
  • Loading branch information
jakub-kocka committed Jun 12, 2024
1 parent c0e0af0 commit 1091def
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/idf_py_actions/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re
import subprocess
import sys
from io import open

import click

Expand All @@ -22,6 +21,7 @@ def executable_exists(args):


def _idf_version_from_cmake():
"""Acquires version of ESP-IDF from version.cmake"""
version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake')
regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)')
ver = {}
Expand Down Expand Up @@ -55,7 +55,7 @@ def idf_version():
'--work-tree=%s' % os.environ['IDF_PATH'],
'describe', '--tags', '--dirty', '--match', 'v*.*',
]).decode('utf-8', 'ignore').strip()
except (subprocess.CalledProcessError, UnicodeError):
except Exception:
# if failed, then try to parse cmake.version file
sys.stderr.write('WARNING: Git version unavailable, reading from source\n')
version = _idf_version_from_cmake()
Expand Down

0 comments on commit 1091def

Please sign in to comment.