Skip to content

Commit dd64379

Browse files
committed
py: Fix version header generation when no tags are available.
1 parent 58b9789 commit dd64379

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

py/makeversionhdr.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ def make_version_header(filename):
7070
info = get_version_info_from_docs_conf()
7171

7272
git_tag, git_hash, ver = info
73+
if len(ver) < 3:
74+
ver = ("0", "0", "0")
75+
version_string = git_hash
76+
else:
77+
version_string = ".".join(ver)
7378

7479
# Generate the file with the git and version info
7580
file_data = """\
@@ -80,9 +85,9 @@ def make_version_header(filename):
8085
#define MICROPY_VERSION_MAJOR (%s)
8186
#define MICROPY_VERSION_MINOR (%s)
8287
#define MICROPY_VERSION_MICRO (%s)
83-
#define MICROPY_VERSION_STRING "%s.%s.%s"
88+
#define MICROPY_VERSION_STRING "%s"
8489
""" % (git_tag, git_hash, datetime.date.today().strftime("%Y-%m-%d"),
85-
ver[0], ver[1], ver[2], ver[0], ver[1], ver[2])
90+
ver[0], ver[1], ver[2], version_string)
8691

8792
# Check if the file contents changed from last time
8893
write_file = True

0 commit comments

Comments
 (0)