Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 977a0ce

Browse files
committed
py: Print tag/version/git describe in uPy banner.
1 parent b4bb3fd commit 977a0ce

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

py/py-version.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22

3+
git_tag="$(git describe || echo unknown)"
34
git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)"
45
git_files_are_clean=1
56
# Check if there are any modified files.
@@ -11,6 +12,7 @@ if [ "${git_files_are_clean}" != "1" ]; then
1112
fi
1213
cat <<EOF
1314
// This file was generated by py/py-version.sh
15+
#define MICROPY_GIT_TAG "${git_tag}"
1416
#define MICROPY_GIT_HASH "${git_hash}"
1517
#define MICROPY_BUILD_DATE "$(date '+%Y-%m-%d')"
1618
EOF

stmhal/pyexec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ int pyexec_friendly_repl(void) {
155155
#endif
156156

157157
friendly_repl_reset:
158-
stdout_tx_str("Micro Python build " MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with STM32F405RG\r\n");
158+
stdout_tx_str("Micro Python " MICROPY_GIT_TAG " (" MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "); " MICROPY_HW_BOARD_NAME " with STM32F405RG\r\n");
159159
stdout_tx_str("Type \"help()\" for more information.\r\n");
160160

161161
// to test ctrl-C

unix/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ STATIC char *prompt(char *p) {
142142
}
143143

144144
STATIC void do_repl(void) {
145-
printf("Micro Python build " MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "; UNIX version\n");
145+
printf("Micro Python " MICROPY_GIT_TAG " (" MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "); UNIX version\n");
146146

147147
for (;;) {
148148
char *line = prompt(">>> ");

0 commit comments

Comments
 (0)