Added publish recipe

This commit is contained in:
Jef Roosens 2020-08-25 18:56:19 +02:00
parent 4044c7551b
commit 4546a21014
3 changed files with 52 additions and 6 deletions

View file

@ -43,6 +43,10 @@ clean-docs:
@ echo "Removing documentation build..."
@ [ ! -e "$(DOCS)/build" ] || rm -r "$(DOCS)/build"
clean-setup:
@ echo 'Removing build artifacts...'
@ [ ! -e "build" ] || rm -rf build
@ find . -maxdepth 1 -type d -name '*.egg-info' -exec rm -rf "{}" \;
# =====DOCS=====
$(VENV)/bin/sphinx-build: build-venv
@ -64,15 +68,25 @@ test: pytest.ini $(VENV)/bin/pytest
# =====PACKAGING=====
package: README.md LICENSE setup.py test
package: README.md LICENSE setup.py test clean-setup
@ echo "Removing build..."
@ [ ! -e "dist" ] || rm -r "dist"
@ echo "Updating wheel & setuptools..."
@ "$(VENV)/bin/pip" install --upgrade --quiet setuptools wheel
@ echo "Running setup.py..."
@ "$(VENV)/bin/python" setup.py sdist bdist_wheel
publish: package
@ echo 'Installing twine...'
@ $(VENV)/bin/pip install --quiet --upgrade twine
@ [ git symbolic-ref HEAD --short = master ] && { \
echo 'Publishing to PyPi Testing...'; \
$(VENV)/bin/python -m twine upload dist/* ; \
} || { \
echo 'Publishing to PyPi Testing...'; \
$(VENV)/bin/python -m twine upload --repository testpypi dist/* ; \
}
# Publish will also come here someday
.PHONY: all clean clean-venv clean-cache clean-docs test package docs \
build-venv run-venv
build-venv run-venv clean-setup