mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'refactor/avoid_using_git_v4.4' into 'release/v4.4'
fix(tools): Avoiding crashing when Git is not present in system when acquiring IDF version (v4.4) See merge request espressif/esp-idf!31437
This commit is contained in:
@@ -4,7 +4,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from io import open
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
@@ -22,6 +21,7 @@ def executable_exists(args):
|
|||||||
|
|
||||||
|
|
||||||
def _idf_version_from_cmake():
|
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')
|
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+)')
|
regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)')
|
||||||
ver = {}
|
ver = {}
|
||||||
@@ -55,7 +55,7 @@ def idf_version():
|
|||||||
'--work-tree=%s' % os.environ['IDF_PATH'],
|
'--work-tree=%s' % os.environ['IDF_PATH'],
|
||||||
'describe', '--tags', '--dirty', '--match', 'v*.*',
|
'describe', '--tags', '--dirty', '--match', 'v*.*',
|
||||||
]).decode('utf-8', 'ignore').strip()
|
]).decode('utf-8', 'ignore').strip()
|
||||||
except (subprocess.CalledProcessError, UnicodeError):
|
except Exception:
|
||||||
# if failed, then try to parse cmake.version file
|
# if failed, then try to parse cmake.version file
|
||||||
sys.stderr.write('WARNING: Git version unavailable, reading from source\n')
|
sys.stderr.write('WARNING: Git version unavailable, reading from source\n')
|
||||||
version = _idf_version_from_cmake()
|
version = _idf_version_from_cmake()
|
||||||
|
Reference in New Issue
Block a user