generated from gormaniac/pyproject-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (56 loc) · 2.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
NAME = stormlibpp
PKG_DIR = src/$(NAME)
.PHONY: help
help: # Display help for all Makefile commands
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
.PHONY: change-version
change-version: # Change the version of this project (requires VERSION=#.#.#)
pipenv run python3 scripts/changever.py $(VERSION)
.PHONY: build
build: # Build the Python package tarball and wheel
pipenv run python3 -m build .
.PHONY: build-storm
build-storm: # Build all Storm packages in this project
./scripts/pkgs/build.sh
.PHONY: push-storm
push: # Push all package JSON files to a Cortex (requires CORTEX=<Telepath URL>)
./scripts/pkgs/push.sh $(CORTEX)
.PHONY: setup
setup: # Setup this project's pipenv environment
pipenv install -d
.PHONY: install-self
install-self: # Install this project's python package using the pipenv's pip
pipenv run pip3 install --editable .
.PHONY: docs
docs: # Build the documentation for this package
./scripts/pkgs/copy-docs.sh
pipenv run sphinx-apidoc -d 1 -t doc/_templates -e -M -T -f -o doc/stormlibpp $(PKG_DIR)
pipenv run sphinx-build doc/ docs/
.PHONY: clean-py
clean-py: # Clean up Python generated files
rm -rf $(PKG_DIR)/__pycache__
rm -rf src/*.egg-info
# Occassionally, this fails if a make release fails after this was run but before
# "dist/*" commited to git. Run "git add dist/*" and rerun make release.
.PHONY: clean
clean: clean-py # Remove build files - including a forced "git rm" of "dist/*"
git rm -f dist/* --ignore-unmatch
rm -rf dist
rm -rf src/private
.PHONY: read-docs
read-docs: # Open the package docs locally
open docs/index.html
.PHONY: release
release: change-version clean setup build docs # Build a new versioned release and push it (requires VERSION=#.#.#)
git add doc/* docs/* pyproject.toml $(PKG_DIR)/__init__.py
git commit -m "build: release v$(VERSION)"
git push
git tag -a v$(VERSION) -m "Release v$(VERSION)"
git push origin v$(VERSION)
$(MAKE) clean-py
.PHONY: tests
tests: # Run the pytest suite for this project.
pipenv run pytest tests/
.PHONY: pypi
pypi: # Upload all Python packages in "dist/" to PyPI.
pipenv run python3 -m twine upload dist/*