Skip to content
Snippets Groups Projects
Commit 977a0ce2 authored by Damien George's avatar Damien George
Browse files

py: Print tag/version/git describe in uPy banner.

parent b4bb3fdb
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
git_tag="$(git describe || echo unknown)"
git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)" git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)"
git_files_are_clean=1 git_files_are_clean=1
# Check if there are any modified files. # Check if there are any modified files.
...@@ -11,6 +12,7 @@ if [ "${git_files_are_clean}" != "1" ]; then ...@@ -11,6 +12,7 @@ if [ "${git_files_are_clean}" != "1" ]; then
fi fi
cat <<EOF cat <<EOF
// This file was generated by py/py-version.sh // This file was generated by py/py-version.sh
#define MICROPY_GIT_TAG "${git_tag}"
#define MICROPY_GIT_HASH "${git_hash}" #define MICROPY_GIT_HASH "${git_hash}"
#define MICROPY_BUILD_DATE "$(date '+%Y-%m-%d')" #define MICROPY_BUILD_DATE "$(date '+%Y-%m-%d')"
EOF EOF
...@@ -155,7 +155,7 @@ int pyexec_friendly_repl(void) { ...@@ -155,7 +155,7 @@ int pyexec_friendly_repl(void) {
#endif #endif
friendly_repl_reset: friendly_repl_reset:
stdout_tx_str("Micro Python build " MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with STM32F405RG\r\n"); stdout_tx_str("Micro Python " MICROPY_GIT_TAG " (" MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "); " MICROPY_HW_BOARD_NAME " with STM32F405RG\r\n");
stdout_tx_str("Type \"help()\" for more information.\r\n"); stdout_tx_str("Type \"help()\" for more information.\r\n");
// to test ctrl-C // to test ctrl-C
......
...@@ -142,7 +142,7 @@ STATIC char *prompt(char *p) { ...@@ -142,7 +142,7 @@ STATIC char *prompt(char *p) {
} }
STATIC void do_repl(void) { STATIC void do_repl(void) {
printf("Micro Python build " MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "; UNIX version\n"); printf("Micro Python " MICROPY_GIT_TAG " (" MICROPY_GIT_HASH " on " MICROPY_BUILD_DATE "); UNIX version\n");
for (;;) { for (;;) {
char *line = prompt(">>> "); char *line = prompt(">>> ");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment