Debian Codegraph @

Makefile

raw
1 # Makefile for the 'humanfriendly' package.
2 #
3 # Author: Peter Odding <[email protected]>
4 # Last Change: March 1, 2020
5 # URL: https://humanfriendly.readthedocs.io
6
7 PACKAGE_NAME = humanfriendly
8 WORKON_HOME ?= $(HOME)/.virtualenvs
9 VIRTUAL_ENV ?= $(WORKON_HOME)/$(PACKAGE_NAME)
10 PYTHON ?= python3
11 PATH := $(VIRTUAL_ENV)/bin:$(PATH)
12 MAKE := $(MAKE) --no-print-directory
13 SHELL = bash
14
15 default:
16 @echo "Makefile for $(PACKAGE_NAME)"
17 @echo
18 @echo 'Usage:'
19 @echo
20 @echo ' make install install the package in a virtual environment'
21 @echo ' make reset recreate the virtual environment'
22 @echo ' make check check coding style (PEP-8, PEP-257)'
23 @echo ' make test run the test suite, report coverage'
24 @echo ' make tox run the tests on all Python versions'
25 @echo ' make readme update usage in readme'
26 @echo ' make docs update documentation using Sphinx'
27 @echo ' make publish publish changes to GitHub/PyPI'
28 @echo ' make clean cleanup all temporary files'
29 @echo
30
31 install:
32 @test -d "$(VIRTUAL_ENV)" || mkdir -p "$(VIRTUAL_ENV)"
33 @test -x "$(VIRTUAL_ENV)/bin/python" || virtualenv --python=$(PYTHON) --quiet "$(VIRTUAL_ENV)"
34 @pip uninstall --yes $(PACKAGE_NAME) &>/dev/null || true
35 @pip install --quiet --no-deps --ignore-installed .
36
37 reset:
38 @$(MAKE) clean
39 @rm -Rf "$(VIRTUAL_ENV)"
40 @$(MAKE) install
41
42 check: install
43 @pip install --upgrade --quiet --requirement=requirements-checks.txt
44 @flake8
45
46 test: install
47 @pip install --quiet --requirement=requirements-tests.txt
48 @py.test --cov
49 @coverage combine || true
50 @coverage html
51
52 tox: install
53 @pip install --quiet tox
54 @tox
55
56 readme: install
57 @pip install --quiet cogapp
58 @cog.py -r README.rst
59
60 docs: readme
61 @pip install --quiet sphinx
62 @cd docs && sphinx-build -nWb html -d build/doctrees . build/html
63
64 publish: install
65 @git push origin && git push --tags origin
66 @$(MAKE) clean
67 @pip install --quiet twine wheel
68 @python setup.py sdist bdist_wheel
69 @twine upload dist/*
70 @$(MAKE) clean
71
72 clean:
73 @rm -Rf *.egg .cache .coverage .tox build dist docs/build htmlcov
74 @find -depth -type d -name __pycache__ -exec rm -Rf {} \;
75 @find -type f -name '*.pyc' -delete
76
77 .PHONY: default install reset check test tox readme docs publish clean