summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpconfig.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index eb3a0eb736..a36f9658fb 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -26,22 +26,32 @@
#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
#define MICROPY_INCLUDED_PY_MPCONFIG_H
-// Current version of MicroPython
+// Current version of MicroPython. This is used by sys.implementation.version
+// as well as a fallback to generate MICROPY_GIT_TAG if the git repo or tags
+// are unavailable.
#define MICROPY_VERSION_MAJOR 1
-#define MICROPY_VERSION_MINOR 21
+#define MICROPY_VERSION_MINOR 22
#define MICROPY_VERSION_MICRO 0
-
-// Combined version as a 32-bit number for convenience
-#define MICROPY_VERSION ( \
- MICROPY_VERSION_MAJOR << 16 \
- | MICROPY_VERSION_MINOR << 8 \
- | MICROPY_VERSION_MICRO)
-
-// String version
-#define MICROPY_VERSION_STRING \
+#define MICROPY_VERSION_PRERELEASE 1
+
+// Combined version as a 32-bit number for convenience to allow version
+// comparison. Doesn't include prerelease state.
+// e.g. #if MICROPY_VERSION < MICROPY_MAKE_VERSION(1, 22, 0)
+#define MICROPY_MAKE_VERSION(major, minor, patch) (major << 16 | minor << 8 | patch)
+#define MICROPY_VERSION MICROPY_MAKE_VERSION(MICROPY_VERSION_MAJOR, MICROPY_VERSION_MINOR, MICROPY_VERSION_MICRO)
+
+// String version. This is only used directly for platform.platform and
+// os.uname().release. All other version info available in the firmware (e.g.
+// the REPL banner) comes from MICROPY_GIT_TAG.
+#define MICROPY_VERSION_STRING_BASE \
MP_STRINGIFY(MICROPY_VERSION_MAJOR) "." \
MP_STRINGIFY(MICROPY_VERSION_MINOR) "." \
MP_STRINGIFY(MICROPY_VERSION_MICRO)
+#if MICROPY_VERSION_PRERELEASE
+#define MICROPY_VERSION_STRING MICROPY_VERSION_STRING_BASE "-preview"
+#else
+#define MICROPY_VERSION_STRING MICROPY_VERSION_STRING_BASE
+#endif
// This file contains default configuration settings for MicroPython.
// You can override any of the options below using mpconfigport.h file