mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
py/modsys: Add sys.implementation._build entry.
For a given MicroPython firmware/executable it can be sometimes important to know how it was built, which variant/board configuration it came from. This commit adds a new field `sys.implementation._build` that can help identify the configuration that MicroPython was built with. For now it's either: * <VARIANT> for unix, webassembly and windows ports * <BOARD>-<VARIANT> for microcontroller ports (the variant is optional) In the future additional elements may be added to this string, separated by a hyphen. Resolves issue #16498. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -19,6 +19,19 @@ if(NOT MICROPY_PREVIEW_VERSION_2)
|
||||
set(MICROPY_PREVIEW_VERSION_2 0)
|
||||
endif()
|
||||
|
||||
# Set the board name.
|
||||
if(MICROPY_BOARD)
|
||||
if(MICROPY_BOARD_VARIANT)
|
||||
set(MICROPY_BOARD_BUILD_NAME ${MICROPY_BOARD}-${MICROPY_BOARD_VARIANT})
|
||||
else()
|
||||
set(MICROPY_BOARD_BUILD_NAME ${MICROPY_BOARD})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${MICROPY_TARGET} PRIVATE
|
||||
MICROPY_BOARD_BUILD_NAME="${MICROPY_BOARD_BUILD_NAME}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Need to do this before extracting MICROPY_CPP_DEF below. Rest of frozen
|
||||
# manifest handling is at the end of this file.
|
||||
if(MICROPY_FROZEN_MANIFEST)
|
||||
|
||||
Reference in New Issue
Block a user