Commit Graph

17 Commits

Author SHA1 Message Date
Damien George 668a7bd28a py/makeversionhdr.py: Always add micro to version string even if it's 0.
Moving forward, tags in this repository will always have three components.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-10 18:39:14 +11:00
David Grayson 2bcd88d556 py/makeversionhdr.py: Optionally get git tag and git hash from env vars.
This is handy when you are doing builds outside of the Git repository but
still want to record that information.

Signed-off-by: David Grayson <davidegrayson@gmail.com>
2023-03-02 23:19:30 +11:00
Jim Mussared 6873a14b61 py/makeversionhdr.py: Allow running outside of repo.
If a CMake-build is run with `make BUILD=/outside/path` then
makeversionheader.py is run with the CWD set to the build directory, which
means the git version lookup will fail and silently fall back to the
mpconfig.h mode (giving the wrong result).

This commit:
 - Uses the location of makeversionheader.py to find the repo path.
 - Allows overriding this path via --repo-path.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-22 14:36:21 +11:00
Damien George c138e10fbb py/makeversionhdr: Fall back to py/mpconfig.h instead of docs/conf.py.
Commit 64af916c11 removed the version string
from docs/conf.py.  py/mpconfig.h is a better place to get the version
from, so use that (when there is no git repository).

Signed-off-by: Damien George <damien@micropython.org>
2022-10-27 13:00:48 +11:00
David Lechner d934f8c8a8 py/makeversionhdr: Add --tags arg to git describe.
This adds the --tags argument to the git describe command that is used
to define the MICROPY_GIT_TAG macro. This makes it match non-annotated
tags. This is useful for MicroPython derivatives that don't use
annotated tags.

Signed-off-by: David Lechner <david@pybricks.com>
2021-07-05 10:41:31 -05:00
iTitou 4fb5f012c3 py/makeversionhdr: Honor SOURCE_DATE_EPOCH if present.
This environment variable, if defined during the build process,
indicates a fixed time that should be used in place of "now" when
such a time is explicitely referenced.

This allows for reproducible builds of micropython.
See https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: iTitou <moiandme@gmail.com>
2021-01-31 17:48:59 +01:00
Mike Wadsten c711c0049e py/makeversionhdr.py: Match only git tags which look like versions.
Some downstream projects may use tags in their repositories for more than
just designating MicroPython releases.  In those cases, the
makeversionhdr.py script would end up using a different tag than intended.
So tell `git describe` to only match tags that look like a MicroPython
version tag, such as `v1.12` or `v2.0`.
2020-10-01 11:01:43 +10:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 7cd59c5bc3 py/mpconfig: Move MICROPY_VERSION macros to static ones in mpconfig.h.
It's more robust to have the version defined statically in a header file,
rather than dynamically generating it via git using a git tag.  In case
git doesn't exist, or a different source control tool is used, it's
important to still have the uPy version number available.
2018-12-22 01:40:38 +11:00
Damien George 6af4515969 py: Use "GEN" consistently for describing files generated in the build. 2018-02-22 12:48:51 +11:00
Damien George b51919f5b7 py/makeversionhdr.py: Update to parse new release line in docs/conf.py.
The line in docs/conf.py with the release/version number was recently
changed and this patch makes the makeversionhdr.py script work again.
2017-07-04 22:37:41 +10:00
omtinez 17c649da3d py/makeversionhdr.py: Work with backslashes in paths.
This script may be called by Windows IDEs (e.g. Visual Studio) and be passed
paths with backslashes.
2015-10-30 11:34:53 +03:00
Damien George 94ef8879cd py/makeversionhdr.py: Use returncode attr to be Python2.7 compat. 2015-08-12 23:28:16 +01:00
Damien George 0d5d16074f py/makeversionhdr.py: Fallback to using docs version if no git repo.
Addresses issue #1420.
2015-08-11 12:27:38 +01:00
Damien George 26b512ea1b py: Get makeqstrdata.py and makeversionhdr.py running under Python 2.6.
These scripts should run under as wide a range of Python versions as
possible.
2015-05-30 23:11:16 +01:00
Damien George 1a97f6721f py: Make makeversionhdr.py extract version from docs/conf.py if no git.
Addresses issue #1285.
2015-05-25 13:26:47 +01:00
Damien George 95f53461c2 py: Replace py-version.sh with makeversionhdr.py, written in Python.
Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
2015-04-28 23:52:36 +01:00