2021-10-28 23:03:09 +00:00
|
|
|
# fresnel-lens makefile
|
2020-09-16 07:41:53 +00:00
|
|
|
|
|
|
|
# You can set these variables from the command line
|
2021-10-28 23:03:09 +00:00
|
|
|
PROJECT = fresnel_lens
|
2020-09-16 07:41:53 +00:00
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
# Put it first so that "make" without argument is like "make help"
|
|
|
|
# Adapted from:
|
|
|
|
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
|
|
help: ## List Makefile targets
|
|
|
|
$(info Makefile documentation)
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
clean-tox:
|
2020-12-22 03:06:02 +00:00
|
|
|
rm --recursive --force ./.mypy_cache
|
|
|
|
rm --recursive --force ./.tox
|
|
|
|
rm --force .coverage
|
2021-05-08 02:39:16 +00:00
|
|
|
rm --force ./$(PROJECT)/openapi.yaml
|
2020-12-22 03:06:02 +00:00
|
|
|
find ./tests -type d -name __pycache__ -prune -exec rm --recursive --force {} \;
|
2020-09-16 07:41:53 +00:00
|
|
|
|
|
|
|
clean-py:
|
2020-12-22 03:06:02 +00:00
|
|
|
rm --recursive --force ./dist
|
|
|
|
rm --recursive --force ./build
|
|
|
|
rm --recursive --force ./*.egg-info
|
|
|
|
find ./$(PROJECT) -type d -name __pycache__ -prune -exec rm --recursive --force {} \;
|
2020-09-16 07:41:53 +00:00
|
|
|
|
|
|
|
clean-docs:
|
2020-12-22 03:06:02 +00:00
|
|
|
rm --recursive --force docs/_build
|
|
|
|
rm --force docs/$(PROJECT)*.rst
|
|
|
|
rm --force docs/modules.rst
|
2020-09-16 07:41:53 +00:00
|
|
|
|
2021-05-02 22:12:04 +00:00
|
|
|
clean: clean-tox clean-py clean-docs ## Clean temp build/cache files and directories
|
|
|
|
rm --force ./*db*
|
2020-09-16 07:41:53 +00:00
|
|
|
|
2021-05-08 02:39:16 +00:00
|
|
|
prep:
|
|
|
|
cp ./openapi.yaml ./$(PROJECT)/openapi.yaml
|
|
|
|
|
|
|
|
wheel: prep ## Build Python binary distribution wheel package
|
2020-09-16 07:41:53 +00:00
|
|
|
poetry build --format wheel
|
|
|
|
|
2021-05-08 02:39:16 +00:00
|
|
|
source: prep ## Build Python source distribution package
|
2020-09-16 07:41:53 +00:00
|
|
|
poetry build --format sdist
|
|
|
|
|
2021-05-08 02:39:16 +00:00
|
|
|
test: clean-tox prep ## Run the project testsuite(s)
|
2021-05-08 02:02:43 +00:00
|
|
|
poetry run tox
|
2020-12-22 03:06:02 +00:00
|
|
|
|
|
|
|
publish: clean test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)
|
|
|
|
@poetry publish --username __token__ --password $(PYPI_API_KEY)
|
2020-09-16 07:41:53 +00:00
|
|
|
|
2020-12-22 03:06:02 +00:00
|
|
|
docs: clean-docs ## Build the documentation using Sphinx
|
2021-05-02 22:12:04 +00:00
|
|
|
poetry run tox -e docs
|
2021-05-08 02:12:13 +00:00
|
|
|
|
|
|
|
dev: ## Create local dev environment
|
|
|
|
poetry install --remove-untracked
|
|
|
|
poetry run pre-commit install
|