summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-10-10 16:50:28 +1100
committerDamien George <damien@micropython.org>2023-10-27 15:28:46 +1100
commit3bf70f16e964370475114ff9658f58870ffaf768 (patch)
treea8938107776003bbfd9e8a5ed6a74976d26cd9cb /py/mpconfig.h
parent3e2706a18dd4071d2d3040549786e659fc3b46b7 (diff)
py/mkrules.mk: Add MICROPY_PREVIEW_VERSION_2.
This provides a way to enable features and changes slated for MicroPython 2.x, by running `make MICROPY_PREVIEW_VERSION_2=1`. Also supported for the cmake ports (except Zephyr). This is an alternative to having a 2.x development branch (or equivalently, keeping a 1.x release branch). Any feature or change that needs to be "hidden" until 2.x can use this flag (either in the Makefile or the preprocessor). A good example is changing function arguments or other public API features, in particular to aid in improving consistency between ports. When `MICROPY_PREVIEW_VERSION_2` is enabled, the REPL banner is amended to say "MicroPython (with v2.0 preview) vX.Y.Z", and sys.implementation gets a new field `_v2` set to `True`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index a36f9658f..6995600ab 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -53,6 +53,12 @@
#define MICROPY_VERSION_STRING MICROPY_VERSION_STRING_BASE
#endif
+// If this is enabled, then in-progress/breaking changes slated for the 2.x
+// release will be enabled.
+#ifndef MICROPY_PREVIEW_VERSION_2
+#define MICROPY_PREVIEW_VERSION_2 (0)
+#endif
+
// This file contains default configuration settings for MicroPython.
// You can override any of the options below using mpconfigport.h file
// located in a directory of your port.
@@ -1828,8 +1834,12 @@ typedef double mp_float_t;
// String used for the banner, and sys.version additional information
#ifndef MICROPY_BANNER_NAME_AND_VERSION
+#if MICROPY_PREVIEW_VERSION_2
+#define MICROPY_BANNER_NAME_AND_VERSION "MicroPython (with v2.0 preview) " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE
+#else
#define MICROPY_BANNER_NAME_AND_VERSION "MicroPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE
#endif
+#endif
// String used for the second part of the banner, and sys.implementation._machine
#ifndef MICROPY_BANNER_MACHINE