set version dynamically

This commit is contained in:
Jesse Bannon 2023-02-20 14:01:10 -08:00
parent 29a67ceeae
commit 0c61ef1377
4 changed files with 11 additions and 4 deletions

3
.gitignore vendored
View file

@ -144,3 +144,6 @@ docker/root/*.whl
docker/root/defaults/examples
.local/
# Ignore updates to root __init__, will write new versions when running make
src/ytdl_sub/__init__.py

View file

@ -1,4 +1,8 @@
export DATE=$(shell date +'%Y.%m.%d')
export REV=$(shell git rev-parse --short HEAD)
export VERSION="$(DATE)+$(REV)"
lint:
@-isort .
@-black .
@ -10,13 +14,14 @@ check_lint:
&& pylint src/ \
&& pydocstyle src/*
wheel: clean
$(shell echo "__version__ = \"$(VERSION)\"" > src/ytdl_sub/__init__.py)
pip3 install build
python3 -m build
docker_stage: wheel
cp dist/*.whl docker/root/
cp -R examples docker/root/defaults/
docker: docker_stage
sudo docker build --no-cache -t ytdl-sub:0.1 docker/
sudo docker build --no-cache -t ytdl-sub:local docker/
docs:
sphinx-build -a -b html docs docs/_html
clean:

View file

@ -1,6 +1,6 @@
[metadata]
name = ytdl-sub
version = attr:ytdl_sub.version.__version__
version = attr:ytdl_sub.__version__
author = Jesse Bannon
description = ytdl automated with metadata creation
author_email = use_github_issues@nope.com

View file

@ -1,2 +1 @@
# `make` overwrites with proper version
__version__ = "0000.00.00"
__version__ = "2023.02.20+29a67ce"