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>
This commit is contained in:
David Grayson 2023-02-22 13:26:02 -08:00 committed by Damien George
parent 0098096682
commit 2bcd88d556

View File

@ -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)