py/makeversionhdr.py: Optionally get git tag and git hash from env vars.

This is handy when you are doing builds outside of the Git repository but
still want to record that information.

Signed-off-by: David Grayson <davidegrayson@gmail.com>
pull/10819/head
David Grayson 2023-02-22 13:26:02 -08:00 zatwierdzone przez Damien George
rodzic 0098096682
commit 2bcd88d556
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -86,8 +86,11 @@ def get_version_info_from_mpconfig(repo_path):
def make_version_header(repo_path, filename):
# Get version info using git, with fallback to py/mpconfig.h
info = get_version_info_from_git(repo_path)
info = None
if "MICROPY_GIT_TAG" in os.environ:
info = [os.environ["MICROPY_GIT_TAG"], os.environ["MICROPY_GIT_HASH"]]
if info is None:
info = get_version_info_from_git(repo_path)
if info is None:
info = get_version_info_from_mpconfig(repo_path)