From 261363855c61a0845e16c03d114d6ccfa6c94816 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 7 Oct 2020 09:36:40 +1100 Subject: [PATCH] build system: Also get IDF version from annotated tags only Builds on previous commit. Note: Getting the project version still pases --tags so still works with plain tags, to keep compatibility for existing projects --- docs/idf_extensions/gen_version_specific_includes.py | 2 +- make/project.mk | 2 +- tools/idf_tools.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/idf_extensions/gen_version_specific_includes.py b/docs/idf_extensions/gen_version_specific_includes.py index ba290a01a6..0707d8344e 100755 --- a/docs/idf_extensions/gen_version_specific_includes.py +++ b/docs/idf_extensions/gen_version_specific_includes.py @@ -196,7 +196,7 @@ def get_version(): """ # Use git to look for a tag try: - tag = subprocess.check_output(["git", "describe", "--tags", "--exact-match"]).strip().decode('utf-8') + tag = subprocess.check_output(["git", "describe", "--exact-match"]).strip().decode('utf-8') is_stable = re.match(r"v[0-9\.]+$", tag) is not None return (tag, "tag", is_stable) except subprocess.CalledProcessError: diff --git a/make/project.mk b/make/project.mk index bd40e64aa6..19e848e688 100644 --- a/make/project.mk +++ b/make/project.mk @@ -338,7 +338,7 @@ endif # If we have `version.txt` then prefer that for extracting IDF version ifeq ("$(wildcard ${IDF_PATH}/version.txt)","") -IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty) +IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --dirty) else IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt) endif diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 3525d29be4..e430472b8b 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -857,7 +857,7 @@ def get_python_env_path(): idf_version_str = version_file.read() else: try: - idf_version_str = subprocess.check_output(['git', 'describe', '--tags'], + idf_version_str = subprocess.check_output(['git', 'describe'], cwd=global_idf_path, env=os.environ).decode() except subprocess.CalledProcessError as e: warn('Git describe was unsuccessul: {}'.format(e))