Debian Codegraph @

Makefile

raw
1 .PHONY: clean clean-test clean-pyc clean-build docs help
2 .DEFAULT_GOAL := help
3 define BROWSER_PYSCRIPT
4 import os, webbrowser, sys
5 try:
6 from urllib import pathname2url
7 except:
8 from urllib.request import pathname2url
9
10 webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
11 endef
12 export BROWSER_PYSCRIPT
13
14 define PRINT_HELP_PYSCRIPT
15 import re, sys
16
17 for line in sys.stdin:
18 match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
19 if match:
20 target, help = match.groups()
21 print("%-20s %s" % (target, help))
22 endef
23 export PRINT_HELP_PYSCRIPT
24 BROWSER := python -c "$$BROWSER_PYSCRIPT"
25
26 help:
27 @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
28
29 clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
30
31
32 clean-build: ## remove build artifacts
33 rm -fr build/
34 rm -fr dist/
35 rm -fr .eggs/
36 find . -name '*.egg-info' -exec rm -fr {} +
37 find . -name '*.egg' -exec rm -f {} +
38
39 clean-pyc: ## remove Python file artifacts
40 find . -name '*.pyc' -exec rm -f {} +
41 find . -name '*.pyo' -exec rm -f {} +
42 find . -name '*~' -exec rm -f {} +
43 find . -name '__pycache__' -exec rm -fr {} +
44
45 clean-test: ## remove test and coverage artifacts
46 rm -fr .tox/
47 rm -fr .pytest_cache/
48 rm -f .coverage
49 rm -fr htmlcov/
50
51 lint: ## check style with flake8
52 flake8 aioresponses tests
53
54 test: ## run tests quickly with the default Python
55
56 python setup.py test
57
58 test-all: ## run tests on every Python version with tox
59 tox
60
61 coverage: ## check code coverage quickly with the default Python
62
63 coverage run --source aioresponses setup.py test
64
65 coverage report -m
66 coverage html
67 $(BROWSER) htmlcov/index.html
68
69 docs: ## generate Sphinx HTML documentation, including API docs
70 rm -f docs/aioresponses.rst
71 rm -f docs/modules.rst
72 sphinx-apidoc -o docs/ aioresponses
73 $(MAKE) -C docs clean
74 $(MAKE) -C docs html
75 $(BROWSER) docs/_build/html/index.html
76
77 servedocs: docs ## compile the docs watching for changes
78 watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
79
80 release: clean ## package and upload a release
81 python setup.py sdist upload
82 python setup.py bdist_wheel upload
83
84 dist: clean ## builds source and wheel package
85 python setup.py sdist
86 python setup.py bdist_wheel
87 ls -l dist
88
89 install: clean ## install the package to the active Python's site-packages
90 python setup.py install