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
This commit is contained in:
Angus Gratton 2020-10-07 09:36:40 +11:00
parent fcda778a11
commit 2e469b52ae
4 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ If the issue cannot be solved after the steps before, please follow these instru
- Development Kit: [ESP32-Wrover-Kit|ESP32-DevKitC|ESP32-PICO-Kit|ESP32-LyraT|ESP32-LyraTD-MSC|none] - Development Kit: [ESP32-Wrover-Kit|ESP32-DevKitC|ESP32-PICO-Kit|ESP32-LyraT|ESP32-LyraTD-MSC|none]
- Kit version (for WroverKit/PicoKit/DevKitC): [v1|v2|v3|v4] - Kit version (for WroverKit/PicoKit/DevKitC): [v1|v2|v3|v4]
- Module or chip used: [ESP32-WROOM-32|ESP32-WROOM-32D|ESP32-WROOM-32U|ESP32-WROVER|ESP32-WROVER-I|ESP32-WROVER-B|ESP32-WROVER-IB|ESP32-SOLO-1|ESP32-PICO-D4|ESP32] - Module or chip used: [ESP32-WROOM-32|ESP32-WROOM-32D|ESP32-WROOM-32U|ESP32-WROVER|ESP32-WROVER-I|ESP32-WROVER-B|ESP32-WROVER-IB|ESP32-SOLO-1|ESP32-PICO-D4|ESP32]
- IDF version (run ``git describe --tags`` to find it): - IDF version (run ``git describe`` to find it):
// v3.2-dev-1148-g96cd3b75c // v3.2-dev-1148-g96cd3b75c
- Build System: [Make|CMake|idf.py] - Build System: [Make|CMake|idf.py]
- Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it): - Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it):

View File

@ -196,7 +196,7 @@ def get_version():
""" """
# Use git to look for a tag # Use git to look for a tag
try: 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 is_stable = re.match(r"v[0-9\.]+$", tag) is not None
return (tag, "tag", is_stable) return (tag, "tag", is_stable)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:

View File

@ -338,7 +338,7 @@ endif
# If we have `version.txt` then prefer that for extracting IDF version # If we have `version.txt` then prefer that for extracting IDF version
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","") 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 else
IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt) IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt)
endif endif

View File

@ -857,7 +857,7 @@ def get_python_env_path():
idf_version_str = version_file.read() idf_version_str = version_file.read()
else: else:
try: 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() cwd=global_idf_path, env=os.environ).decode()
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
warn('Git describe was unsuccessul: {}'.format(e)) warn('Git describe was unsuccessul: {}'.format(e))