Skip to content

Commit

Permalink
Add additional version info to os.uname().version.
Browse files Browse the repository at this point in the history
This additional info can be used to tell the exact git commit from this
repository that was used to build the firmware.
  • Loading branch information
dpgeorge authored and markshannon committed May 3, 2017
1 parent a11ce23 commit 327e3e8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/microbit/modos.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include "py/objtuple.h"
#include "py/objstr.h"
#include "genhdr/mpversion.h"
#include YOTTA_BUILD_INFO_HEADER

#define _MP_STRINGIFY(x) #x
#define MP_STRINGIFY(x) _MP_STRINGIFY(x)

#define RELEASE "1.0"

Expand All @@ -39,7 +43,14 @@ STATIC const qstr os_uname_info_fields[] = {
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, RELEASE);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj,
"micro:bit v" RELEASE
"-" MP_STRINGIFY(YOTTA_BUILD_VCS_DESCRIPTION)
#if YOTTA_BUILD_VCS_CLEAN == 0
"-dirty"
#endif
" on " MP_STRINGIFY(YOTTA_BUILD_YEAR) "-" MP_STRINGIFY(YOTTA_BUILD_MONTH) "-" MP_STRINGIFY(YOTTA_BUILD_DAY)
"; MicroPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);

STATIC MP_DEFINE_ATTRTUPLE(
Expand Down

0 comments on commit 327e3e8

Please sign in to comment.