diff --git a/tools/ci/checkout_project_ref.py b/tools/ci/checkout_project_ref.py index 5b6b332c9c..e9c060a1b0 100755 --- a/tools/ci/checkout_project_ref.py +++ b/tools/ci/checkout_project_ref.py @@ -34,16 +34,20 @@ def target_branch_candidates(proj_name): except (KeyError, TypeError): pass # branch name read from IDF - git_describe = subprocess.check_output(["git", "describe", "--tags", "HEAD"]) - match = IDF_GIT_DESCRIBE_PATTERN.search(git_describe) - if match: - major_revision = match.group(1) - minor_revision = match.group(2) - # release branch - candidates.append("release/v{}.{}".format(major_revision, minor_revision)) - # branch to match all major branches, like v3.x or v3 - candidates.append("release/v{}.x".format(major_revision)) - candidates.append("release/v{}".format(major_revision)) + try: + git_describe = subprocess.check_output(["git", "describe", "--tags", "HEAD"]) + match = IDF_GIT_DESCRIBE_PATTERN.search(git_describe.decode()) + if match: + major_revision = match.group(1) + minor_revision = match.group(2) + # release branch + candidates.append("release/v{}.{}".format(major_revision, minor_revision)) + # branch to match all major branches, like v3.x or v3 + candidates.append("release/v{}.x".format(major_revision)) + candidates.append("release/v{}".format(major_revision)) + except subprocess.CalledProcessError: + # this should not happen as IDF should have describe message + pass return [c for c in candidates if c] # filter out null value diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 30ed7b6389..c005ecd6f4 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -175,7 +175,7 @@ def run_cmd_check_output(cmd, input_text=None, extra_paths=None): input_text = input_text.encode() result = subprocess.run(cmd, capture_output=True, check=True, input=input_text) return result.stdout + result.stderr - except AttributeError: + except (AttributeError, TypeError): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate(input_text) if p.returncode != 0: