dynamically generate version number based on git
This commit is contained in:
parent
1302cb914c
commit
35abad327e
|
@ -155,6 +155,9 @@ cython_debug/
|
|||
# IDEs/editors
|
||||
*.sw*
|
||||
|
||||
# build version metadata
|
||||
_version.py
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
|
|
|
@ -8,9 +8,20 @@ import sys
|
|||
|
||||
import grpc
|
||||
|
||||
# dynamically generate version number
|
||||
try:
|
||||
# packaged/pip install -e . value
|
||||
from ._version import version as __version__
|
||||
except ImportError:
|
||||
# local clone value
|
||||
from setuptools_scm import get_version
|
||||
__version__ = get_version(root='..', relative_to=__file__)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# parse flags that are common to many tools (e.g. adding paths for finding .proto files)
|
||||
core_parser = argparse.ArgumentParser(add_help=False)
|
||||
core_parser.add_argument('-v', '--version', action='version', version=f"%(prog)s {__version__}")
|
||||
core_parser.add_argument('--proto-files-path', type=pathlib.Path, default=list(), action='append',
|
||||
help="path to .proto files to read, including dependencies; you will likely need "
|
||||
"to supply this twice, once for GP2040-CE's .proto files and once for nanopb's")
|
||||
|
|
|
@ -24,7 +24,6 @@ def get_config(filename):
|
|||
def visualize():
|
||||
"""Pretty print the contents of GP2040-CE's storage."""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="visualize-storage",
|
||||
description="Read a the configuration storage section from a GP2040-CE board dump and print out its contents.",
|
||||
parents=[core_parser],
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
[build-system]
|
||||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
|
||||
|
||||
[project]
|
||||
name = "gp2040ce-binary-tools"
|
||||
version = "0"
|
||||
description = "Tools for working with GP2040-CE binary dumps."
|
||||
readme = "README.md"
|
||||
license = {text = "MIT"}
|
||||
|
@ -9,13 +11,17 @@ authors = [
|
|||
]
|
||||
requires-python = ">=3.8"
|
||||
dependencies = ["grpcio-tools"]
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["flake8", "flake8-blind-except", "flake8-builtins", "flake8-docstrings", "flake8-executable", "flake8-fixme",
|
||||
"flake8-isort", "flake8-logging-format", "flake8-mutable", "flake8-pyproject", "pip-tools"]
|
||||
"flake8-isort", "flake8-logging-format", "flake8-mutable", "flake8-pyproject", "pip-tools", "setuptools-scm"]
|
||||
|
||||
[project.scripts]
|
||||
visualize-storage = "gp2040ce_bintools.storage:visualize"
|
||||
|
||||
[tool.flake8]
|
||||
max-line-length = 120
|
||||
|
||||
[tool.setuptools_scm]
|
||||
write_to = "gp2040ce_bintools/_version.py"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile with Python 3.10
|
||||
# by the following command:
|
||||
#
|
||||
# pip-compile --extra=dev --output-file=requirements/requirements-dev.txt pyproject.toml
|
||||
# pip-compile --extra=dev --output-file=requirements/requirements-dev.txt
|
||||
#
|
||||
build==0.10.0
|
||||
# via pip-tools
|
||||
|
@ -44,7 +44,9 @@ isort==5.12.0
|
|||
mccabe==0.7.0
|
||||
# via flake8
|
||||
packaging==23.1
|
||||
# via build
|
||||
# via
|
||||
# build
|
||||
# setuptools-scm
|
||||
pip-tools==6.13.0
|
||||
# via gp2040ce-binary-tools (pyproject.toml)
|
||||
protobuf==4.23.3
|
||||
|
@ -57,12 +59,17 @@ pyflakes==3.0.1
|
|||
# via flake8
|
||||
pyproject-hooks==1.0.0
|
||||
# via build
|
||||
setuptools-scm==7.1.0
|
||||
# via gp2040ce-binary-tools (pyproject.toml)
|
||||
snowballstemmer==2.2.0
|
||||
# via pydocstyle
|
||||
tomli==2.0.1
|
||||
# via
|
||||
# build
|
||||
# flake8-pyproject
|
||||
# setuptools-scm
|
||||
typing-extensions==4.6.3
|
||||
# via setuptools-scm
|
||||
wheel==0.40.0
|
||||
# via pip-tools
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile with Python 3.10
|
||||
# by the following command:
|
||||
#
|
||||
# pip-compile --output-file=requirements/requirements.txt pyproject.toml
|
||||
# pip-compile --output-file=requirements/requirements.txt
|
||||
#
|
||||
grpcio==1.54.2
|
||||
# via grpcio-tools
|
||||
|
|
Loading…
Reference in New Issue