aboutsummaryrefslogtreecommitdiff
path: root/py/makeversionhdr.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-12-15 15:13:33 +1100
committerDamien George <damien.p.george@gmail.com>2018-12-22 01:40:38 +1100
commit7cd59c5bc3ed2d4ade54e73fae18985b4b46ee42 (patch)
tree34524fa1c2f31addcad3374c8f05702128cd8a5c /py/makeversionhdr.py
parentce0c58117913f805db99767b22ecb7255b8686a1 (diff)
py/mpconfig: Move MICROPY_VERSION macros to static ones in mpconfig.h.
It's more robust to have the version defined statically in a header file, rather than dynamically generating it via git using a git tag. In case git doesn't exist, or a different source control tool is used, it's important to still have the uPy version number available.
Diffstat (limited to 'py/makeversionhdr.py')
-rw-r--r--py/makeversionhdr.py24
1 files changed, 4 insertions, 20 deletions
diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py
index aedc292e4..2ab99d89b 100644
--- a/py/makeversionhdr.py
+++ b/py/makeversionhdr.py
@@ -46,15 +46,7 @@ def get_version_info_from_git():
except OSError:
return None
- # Try to extract MicroPython version from git tag
- if git_tag.startswith("v"):
- ver = git_tag[1:].split("-")[0].split(".")
- if len(ver) == 2:
- ver.append("0")
- else:
- ver = ["0", "0", "1"]
-
- return git_tag, git_hash, ver
+ return git_tag, git_hash
def get_version_info_from_docs_conf():
with open(os.path.join(os.path.dirname(sys.argv[0]), "..", "docs", "conf.py")) as f:
@@ -62,10 +54,7 @@ def get_version_info_from_docs_conf():
if line.startswith("version = release = '"):
ver = line.strip().split(" = ")[2].strip("'")
git_tag = "v" + ver
- ver = ver.split(".")
- if len(ver) == 2:
- ver.append("0")
- return git_tag, "<no hash>", ver
+ return git_tag, "<no hash>"
return None
def make_version_header(filename):
@@ -74,7 +63,7 @@ def make_version_header(filename):
if info is None:
info = get_version_info_from_docs_conf()
- git_tag, git_hash, ver = info
+ git_tag, git_hash = info
# Generate the file with the git and version info
file_data = """\
@@ -82,12 +71,7 @@ def make_version_header(filename):
#define MICROPY_GIT_TAG "%s"
#define MICROPY_GIT_HASH "%s"
#define MICROPY_BUILD_DATE "%s"
-#define MICROPY_VERSION_MAJOR (%s)
-#define MICROPY_VERSION_MINOR (%s)
-#define MICROPY_VERSION_MICRO (%s)
-#define MICROPY_VERSION_STRING "%s.%s.%s"
-""" % (git_tag, git_hash, datetime.date.today().strftime("%Y-%m-%d"),
- ver[0], ver[1], ver[2], ver[0], ver[1], ver[2])
+""" % (git_tag, git_hash, datetime.date.today().strftime("%Y-%m-%d"))
# Check if the file contents changed from last time
write_file = True