Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
6582a417
Commit
6582a417
authored
Apr 4, 2014
by
Damien George
Browse files
Options
Downloads
Plain Diff
Merge pull request #421 from dhylands/git-version
Add the git version and build-date to the banner
parents
70193b2b
bf7d690e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/py-version.sh
+16
-0
16 additions, 0 deletions
py/py-version.sh
py/py.mk
+9
-1
9 additions, 1 deletion
py/py.mk
stmhal/pyexec.c
+2
-1
2 additions, 1 deletion
stmhal/pyexec.c
with
27 additions
and
2 deletions
py/py-version.sh
0 → 100755
+
16
−
0
View file @
6582a417
#!/bin/bash
git_hash
=
"
$(
git rev-parse
--short
HEAD 2> /dev/null
||
echo
unknown
)
"
git_files_are_clean
=
1
# Check if there are any modified files.
git diff
--no-ext-diff
--quiet
--exit-code
2> /dev/null
||
git_files_are_clean
=
0
# Check if there are any staged files.
git diff-index
--cached
--quiet
HEAD
--
2> /dev/null
||
git_files_are_clean
=
0
if
[
"
${
git_files_are_clean
}
"
!=
"1"
]
;
then
git_hash
=
"
${
git_hash
}
-dirty"
fi
cat
<<
EOF
// This file was generated by py/py-version.sh
#define MICROPY_GIT_HASH "
${
git_hash
}
"
#define MICROPY_BUILD_DATE "
$(
date
'+%Y-%m-%d'
)
"
EOF
This diff is collapsed.
Click to expand it.
py/py.mk
+
9
−
1
View file @
6582a417
...
...
@@ -90,6 +90,14 @@ PY_O_BASENAME = \
# prepend the build destination prefix to the py object files
PY_O
=
$(
addprefix
$(
PY_BUILD
)
/,
$(
PY_O_BASENAME
))
# Anything that depends on FORCE will be considered out-of-date
FORCE
:
.PHONY
:
FORCE
$(PY_BUILD)/py-version.h
:
FORCE
$(
Q
)$(
PY_SRC
)
/py-version.sh
>
$@
.tmp
$(
Q
)
if
[
-f
"
$@
"
]
&&
cmp
-s
$@
$@
.tmp
;
then
rm
$@
.tmp
;
else
echo
"Generating
$@
"
;
mv
$@
.tmp
$@
;
fi
# qstr data
# Adding an order only dependency on $(PY_BUILD) causes $(PY_BUILD) to get
...
...
@@ -104,7 +112,7 @@ $(PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqst
# the right .o's to get recompiled if the generated.h file changes. Adding
# an order-only dependendency to all of the .o's will cause the generated .h
# to get built before we try to compile any of them.
$(PY_O)
:
| $(PY_BUILD)/qstrdefs.generated.h
$(PY_O)
:
| $(PY_BUILD)/qstrdefs.generated.h
$(PY_BUILD)/py-version.h
# emitters
...
...
This diff is collapsed.
Click to expand it.
stmhal/pyexec.c
+
2
−
1
View file @
6582a417
...
...
@@ -23,6 +23,7 @@
#include
"pyexec.h"
#include
"storage.h"
#include
"usb.h"
#include
"build/py/py-version.h"
pyexec_mode_kind_t
pyexec_mode_kind
=
PYEXEC_MODE_FRIENDLY_REPL
;
STATIC
bool
repl_display_debugging_info
=
0
;
...
...
@@ -155,7 +156,7 @@ int pyexec_friendly_repl(void) {
#endif
friendly_repl_reset:
stdout_tx_str
(
"Micro Python build
<git hash> on 25/1/2014
; "
MICROPY_HW_BOARD_NAME
" with STM32F405RG
\r\n
"
);
stdout_tx_str
(
"Micro Python build
"
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
"
);
// to test ctrl-C
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment