diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-01 13:40:48 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-01 15:12:52 -0700 |
| commit | dd64379c0dd369504e0ca0d7bb8253110b071859 (patch) | |
| tree | d95f3c4849dca5a8a4b7cc414bd95ca1e860fb27 /py | |
| parent | 58b9789d0c824c665db744ef3653d6304e908bc0 (diff) | |
py: Fix version header generation when no tags are available.
Diffstat (limited to 'py')
| -rw-r--r-- | py/makeversionhdr.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index e7cc4d630..9c7f26822 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -70,6 +70,11 @@ def make_version_header(filename): info = get_version_info_from_docs_conf() 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 file_data = """\ @@ -80,9 +85,9 @@ def make_version_header(filename): #define MICROPY_VERSION_MAJOR (%s) #define MICROPY_VERSION_MINOR (%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"), - 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 write_file = True |
