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 -f .coverage
48- rm -fr htmlcov/
49- rm -f test_readme.py
50-
51-
52- lint : # # check style with flake8
53- flake8 python_simple_trustpilo_api_client tests
54-
55- test : # # run tests quickly with the default Python
56- py.test
57-
58- tox : # # run tests quickly with the default Python
59- rm -rf .tox
60- detox
61-
62- test-all : clean # # run all versions/tests with dtox (dockerized)
63- @echo " Running all tests in Docker using dtox"
64- rm -rf .tox
65- docker run --rm -it -v " $$ PWD" :/src:ro realcundo/dtox " $$ PWD"
66-
67- coverage : # # check code coverage quickly with the default Python
68- coverage run --source python_simple_trustpilo_api_client -m pytest
69-
70- coverage report -m
71- coverage html
72- $(BROWSER ) htmlcov/index.html
73-
74- release : clean # # package and upload a release
75- python setup.py sdist upload
76- python setup.py bdist_wheel upload
77-
78- dist : clean # # builds source and wheel package
79- python setup.py sdist
80- python setup.py bdist_wheel
81- ls -l dist
1+ release :
2+ rm dist/*
3+ python setup.py sdist build
4+ python -m twine upload dist/*
0 commit comments