From d93380e8f637ce43f7257507c922ff545f791e05 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Thu, 10 Feb 2022 17:29:41 +0100 Subject: [PATCH] Tools: Don't print git failure message for version detection --- tools/idf_tools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/idf_tools.py b/tools/idf_tools.py index eb5dd57e39..83d3cdca7e 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -988,12 +988,15 @@ def get_python_env_path(): # type: () -> Tuple[str, str, str, str] idf_version_str = '' try: idf_version_str = subprocess.check_output(['git', 'describe'], - cwd=global_idf_path, env=os.environ).decode() + cwd=global_idf_path, env=os.environ, + stderr=subprocess.DEVNULL).decode() except OSError: # OSError should cover FileNotFoundError and WindowsError warn('Git was not found') - except subprocess.CalledProcessError as e: - warn('Git describe was unsuccessful: {}'.format(e.output)) + except subprocess.CalledProcessError: + # This happens quite often when the repo is shallow. Don't print a warning because there are other + # possibilities for version detection. + pass match = re.match(r'^v([0-9]+\.[0-9]+).*', idf_version_str) if match: idf_version = match.group(1) # type: Optional[str]