preserves/implementations/python/Makefile

48 lines
1.2 KiB
Makefile

# This used to just be
# PACKAGEVERSION := "`python3 setup.py --version`"
PACKAGEVERSION := $(shell python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
all: test build-docs
test-in-docker: build-only
docker run --rm -v `pwd`/dist:/dist python /bin/bash -c 'pip install dist/preserves-$(PACKAGEVERSION)*.whl && python -c "import preserves.schema; print(preserves.schema)"'
test: update-test-data
python3 -m unittest discover -s tests
build-docs:
mkdocs build -d ../../python/$(PACKAGEVERSION)
./update-doc-versions.sh
serve-docs:
mkdocs serve
coverage: update-test-data
python3-coverage run --branch -m unittest discover -s tests
python3-coverage html
update-test-data:
rsync ../../tests/samples.bin ../../tests/samples.pr tests
tag:
git tag python-preserves@$(PACKAGEVERSION)
clean:
rm -rf htmlcov
find . -iname __pycache__ -o -iname '*.pyc' | xargs rm -rf
rm -f .coverage
rm -rf preserves.egg-info build dist
#
# sudo apt install python3-wheel twine
#
publish: clean build
twine upload dist/*
build: build-docs build-only
build-only: dist/preserves-$(PACKAGEVERSION).tar.gz
dist/preserves-$(PACKAGEVERSION).tar.gz:
python3 -m build