Introduce Makefile

pull/1931/head
Kieran R. Prasch 2020-04-24 10:55:10 -07:00
parent dda6123742
commit 7322003913
1 changed files with 80 additions and 1 deletions

View File

@ -1,7 +1,86 @@
.PHONY: clean-pyc clean-build docs
docs:
help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "release - package and push a new release"
@echo "dist - package"
clean: clean-build clean-pyc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
lint:
flake8 nucypher
test:
pytest tests
build-docs:
sphinx-apidoc -fME -o docs/source/api -t docs/source/apidoc . setup.py "*conftest*" "tests" "nucypher/utilities/*" "scripts"
# sphinx-apidoc [OPTIONS] -o <OUTPUT_PATH> <MODULE_PATH> [EXCLUDE_PATTERN …]
$(MAKE) -C docs clean
$(MAKE) -C docs html
# $(MAKE) -C docs html
validate-docs: build-docs
# Required dependencies from docs/requirements.txt
python newsfragments/validate_files.py
towncrier --draft
docs: build-docs validate-docs
readlink -f docs/build/html/index.html
mac-docs: build-docs
open -f docs/_build/html/index.html
release: clean
# Enable GPG signing of release commits
CURRENT_SIGN_SETTING=$(git config commit.gpgSign)
git config commit.gpgSign true
# Let UPCOMING_VERSION be the version that is used for the current bump
$(eval UPCOMING_VERSION=$(shell bumpversion $(bump) --dry-run --list | grep new_version= | sed 's/new_version=//g'))
# Now generate the release notes to have them included in the release commit
towncrier --yes --version $(UPCOMING_VERSION)
# We need --allow-dirty because of the generated release_notes file but it is safe because the
# previous dry-run runs *without* --allow-dirty which ensures it's really just the release notes
# file that we are allowing to sit here dirty, waiting to get included in the release commit.
bumpversion --allow-dirty $(bump)
git push upstream master && git push upstream $(UPCOMING_VERSION)
# Restore the original system setting for commit signing
git config commit.gpgSign "$(CURRENT_SIGN_SETTING)"
dist: clean
# Build a source distribution and wheel
python setup.py sdist bdist_wheel
ls -l dist
package: clean
# Build a source distribution and wheel then build a smoke test virtual env from the wheel
python setup.py sdist bdist_wheel
python scripts/release/test_package.py
lock: clean
# Relock dependencies
scripts/installation/relock_dependencies.sh
env: lock
# Relock dependencies and generate a pipenv virtualenv from the result
pipenv run pip install -e . -r dev-requirements.txt
pipenv run nucypher --version
install: clean
# Development installation
pipenv run pip install -e . -r dev-requirements.txt
# Show installed version and verify entry point
pipenv run nucypher --version