py: Fix version header generation when no tags are available.
This commit is contained in:
parent
58b9789d0c
commit
dd64379c0d
@ -70,6 +70,11 @@ def make_version_header(filename):
|
|||||||
info = get_version_info_from_docs_conf()
|
info = get_version_info_from_docs_conf()
|
||||||
|
|
||||||
git_tag, git_hash, ver = info
|
git_tag, git_hash, ver = info
|
||||||
|
if len(ver) < 3:
|
||||||
|
ver = ("0", "0", "0")
|
||||||
|
version_string = git_hash
|
||||||
|
else:
|
||||||
|
version_string = ".".join(ver)
|
||||||
|
|
||||||
# Generate the file with the git and version info
|
# Generate the file with the git and version info
|
||||||
file_data = """\
|
file_data = """\
|
||||||
@ -80,9 +85,9 @@ def make_version_header(filename):
|
|||||||
#define MICROPY_VERSION_MAJOR (%s)
|
#define MICROPY_VERSION_MAJOR (%s)
|
||||||
#define MICROPY_VERSION_MINOR (%s)
|
#define MICROPY_VERSION_MINOR (%s)
|
||||||
#define MICROPY_VERSION_MICRO (%s)
|
#define MICROPY_VERSION_MICRO (%s)
|
||||||
#define MICROPY_VERSION_STRING "%s.%s.%s"
|
#define MICROPY_VERSION_STRING "%s"
|
||||||
""" % (git_tag, git_hash, datetime.date.today().strftime("%Y-%m-%d"),
|
""" % (git_tag, git_hash, datetime.date.today().strftime("%Y-%m-%d"),
|
||||||
ver[0], ver[1], ver[2], ver[0], ver[1], ver[2])
|
ver[0], ver[1], ver[2], version_string)
|
||||||
|
|
||||||
# Check if the file contents changed from last time
|
# Check if the file contents changed from last time
|
||||||
write_file = True
|
write_file = True
|
||||||
|
Loading…
Reference in New Issue
Block a user