diff --git a/Makefile b/Makefile index decc9ef..662c9b9 100644 --- a/Makefile +++ b/Makefile @@ -70,9 +70,9 @@ release : [[ -d venv.release ]] && rm -rf venv.release || true [[ -d dist ]] && rm -rf dist || true $(PYTHON) -mvenv venv.release - venv.release/bin/pip install twine - venv.release/bin/pip install --upgrade build - venv.release/bin/python -m build + FEDITEST_RELEASE_VERSION=y venv.release/bin/pip install twine + FEDITEST_RELEASE_VERSION=y venv.release/bin/pip install --upgrade build + FEDITEST_RELEASE_VERSION=y venv.release/bin/python -m build @echo WARNING: YOU ARE NOT DONE YET @echo The actual push to pypi.org you need to do manually. Enter: @echo venv.release/bin/twine upload dist/* diff --git a/hatch_build.py b/hatch_build.py new file mode 100644 index 0000000..93eccdd --- /dev/null +++ b/hatch_build.py @@ -0,0 +1,17 @@ +# +# Set a dynamic version number, see https://hatch.pypa.io/dev/how-to/config/dynamic-metadata/ +# At release time, override with env var: FEDITEST_RELEASE_VERSION=y +# + +from datetime import datetime +import os + +from hatchling.metadata.plugin.interface import MetadataHookInterface + + +class JSONMetaDataHook(MetadataHookInterface): + def update(self, metadata): + if 'FEDITEST_RELEASE_VERSION' in os.environ and os.environ['FEDITEST_RELEASE_VERSION'].lower() == 'y': + metadata['version'] = metadata['base_version'] + else: + metadata['version'] = metadata['base_version'] + '.dev' + datetime.now().strftime("%Y%m%d%H%M%S") diff --git a/pyproject.toml b/pyproject.toml index 1d91783..b1e555a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,8 @@ build-backend = "hatchling.build" [project] name = "feditest" -version = "0.5" +base_version = "0.6" +dynamic = ["version"] authors = [ { name="Johannes Ernst", email="git@j12t.org" }, { name="Steve Bate", email="svc-github@stevebate.net" } @@ -62,6 +63,9 @@ exclude = [ "docs/" ] +[tool.hatch.metadata.hooks.custom] +# Empty: https://hatch.pypa.io/dev/how-to/config/dynamic-metadata/ + [tool.pylint."MESSAGES CONTROL"] max-line-length=120 disable="arguments-renamed, empty-docstring, global-variable-not-assigned, line-too-long, missing-class-docstring, missing-function-docstring, too-few-public-methods, too-many-arguments"