File: Makefile

package info (click to toggle)
python-cogapp 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 388 kB
  • sloc: python: 3,449; makefile: 79
file content (92 lines) | stat: -rw-r--r-- 2,708 bytes parent folder | download
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Makefile for cog work.

# A command to get the current version from cogapp.py
VERSION := $$(python -c "import cogapp.cogapp; print(cogapp.cogapp.__version__)")

.PHONY: help clean sterile test

help:			## Show this help.
	@echo "Available targets:"
	@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "  %-26s%s\n", $$1, $$2}'

clean:			## Remove artifacts of test execution, installation, etc.
	-rm -rf build
	-rm -rf dist
	-rm -f MANIFEST
	-rm -f *.pyc */*.pyc */*/*.pyc */*/*/*.pyc
	-rm -f *.pyo */*.pyo */*/*.pyo */*/*/*.pyo
	-rm -f *$$py.class */*$$py.class */*/*$$py.class */*/*/*$$py.class
	-rm -rf __pycache__ */__pycache__ */*/__pycache__
	-rm -f *.bak */*.bak */*/*.bak */*/*/*.bak
	-rm -f .coverage .coverage.* coverage.xml
	-rm -rf cogapp.egg-info htmlcov
	-rm -rf docs/_build

sterile: clean		## Remove all non-controlled content.
	-rm -rf .tox*
	-rm -rf .*_cache

test:			## Run the test suite.
	tox -q

# Docs

.PHONY: cogdoc lintdoc dochtml

# Normally I'd put this in a comment in index.px, but the
# quoting/escaping would be impossible.
COGARGS = -cP --markers='{{{cog }}} {{{end}}}' docs/running.rst

cogdoc:			## Run cog to keep the docs correct.
	python -m cogapp -r $(COGARGS)

lintdoc:		## Check that the docs are up-to-date.
	@python -m cogapp --check --check-fail-msg='Docs need to be updated: `make cogdoc`' --diff $(COGARGS)

dochtml:		## Build local docs.
	$(MAKE) -C docs html

# Release

.PHONY: dist pypi testpypi tag release check_release _check_credentials _check_manifest _check_tree _check_version

dist:			## Build distribution artifacts.
	python -m build
	twine check dist/*

pypi:			## Upload distributions to PyPI.
	twine upload --verbose dist/*

testpypi:		## Upload distributions to test PyPI
	twine upload --verbose --repository testpypi --password $$TWINE_TEST_PASSWORD dist/*

tag:			## Make a git tag with the version number
	git tag -s -m "Version $(VERSION)" v$(VERSION)
	git push --all

release: _check_credentials clean check_release dist pypi tag ## Do all the steps for a release
	@echo "Release $(VERSION) complete!"

check_release: clean dist _check_manifest _check_tree _check_version ## Check that we are ready for a release
	@echo "Release checks passed"

_check_credentials:
	@if [[ -z "$$TWINE_PASSWORD" ]]; then \
		echo 'Missing TWINE_PASSWORD'; \
		exit 1; \
	fi

_check_manifest:
	python -m check_manifest

_check_tree:
	@if [[ -n $$(git status --porcelain) ]]; then \
		echo 'There are modified files! Did you forget to check them in?'; \
		exit 1; \
	fi

_check_version:
	@if git tag | grep -q -w v$(VERSION); then \
		echo 'A git tag for this version exists! Did you forget to bump the version?'; \
		exit 1; \
	fi