1 .PHONY
: clean clean-test clean-pyc clean-build docs help
4 define BROWSER_PYSCRIPT
5 import os
, webbrowser
, sys
8 from urllib import pathname2url
10 from urllib.request import pathname2url
12 webbrowser.open
("file://" + pathname2url
(os.path.abspath
(sys.argv
[1])))
14 export BROWSER_PYSCRIPT
16 define PRINT_HELP_PYSCRIPT
19 for line in sys.stdin
:
20 match
= re.match
(r
'^([a-zA-Z_-]+):.*?## (.*)$$', line
)
22 target
, help
= match.groups
()
23 print("%-20s %s" % (target
, help
))
25 export PRINT_HELP_PYSCRIPT
27 BROWSER
:= python
-c
"$$BROWSER_PYSCRIPT"
30 @python
-c
"$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST
)
32 clean: clean-build clean-pyc clean-test
## remove all build, test, coverage and Python artifacts
34 clean-build
: ## remove build artifacts
38 find .
-name
'*.egg-info' -exec
rm -fr
{} +
39 find .
-name
'*.egg' -exec
rm -f
{} +
41 clean-pyc
: ## remove Python file artifacts
42 find .
-name
'*.pyc' -exec
rm -f
{} +
43 find .
-name
'*.pyo' -exec
rm -f
{} +
44 find .
-name
'*~' -exec
rm -f
{} +
45 find .
-name
'__pycache__' -exec
rm -fr
{} +
47 clean-test
: ## remove test and coverage artifacts
53 lint
: ## check style with flake8
54 flake8 ifupdown2 tests
56 test: ## run tests quickly with the default Python
59 test-all
: ## run tests on every Python version with tox
62 coverage
: ## check code coverage quickly with the default Python
63 coverage run
--source ifupdown2
-m pytest
66 $(BROWSER
) htmlcov
/index.html
68 docs
: ## generate Sphinx HTML documentation, including API docs
69 rm -f docs
/ifupdown2.rst
70 rm -f docs
/modules.rst
71 sphinx-apidoc
-o docs
/ ifupdown2
74 $(BROWSER
) docs
/_build
/html
/index.html
76 servedocs
: docs
## compile the docs watching for changes
77 watchmedo shell-command
-p
'*.rst' -c
'$(MAKE) -C docs html' -R
-D .
79 testpy
: ## package and upload to testpy
80 python setup.py sdist bdist_wheel
81 twine upload
--repository-url https
://test.pypi.org
/legacy
/ dist/*
82 @echo
"Install ifupdown2 from testpy 'pip install --index-url https://test.pypi.org/simple/ ifupdown2'"
84 release
: dist ## package and upload a release
87 dist: clean ## builds source and wheel package
89 python setup.py bdist_wheel
92 install: clean ## install the package to the active Python's site-packages
93 python setup.py
install
95 deb
: clean ## create a debian package (.deb)
96 debuild
-b
-rfakeroot
-us
-uc