forked from ToolSense/telegraf_pyplug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 1.53 KB
/
Copy pathMakefile
File metadata and controls
58 lines (46 loc) · 1.53 KB
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
.PHONY: all prepare-dev venv lint test clean build test_upload upload
PROJECT=telegraf_pyplug
SHELL:=/bin/bash
VENV_NAME?=venv
PYTHON=$(shell pwd)/${VENV_NAME}/bin/python
all:
@echo "make prepare-dev"
@echo " Create python virtual environment and install dependencies."
@echo "make lint"
@echo " Run lint on project."
@echo "make test"
@echo " Run tests on project."
@echo "make clean"
@echo " Remove python artifacts, docker/ and virtualenv"
@echo "make build"
@echo " Creates Python package."
@echo "make test_upload"
@echo " Uploads package to TEST PyPI."
@echo "make upload"
@echo " Uploads package to PyPI."
prepare-dev:
which virtualenv || python3 -m pip install virtualenv
make venv
venv: $(VENV_NAME)/bin/activate
$(VENV_NAME)/bin/activate: setup.py
test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME)
${PYTHON} -m pip install -U pip setuptools
${PYTHON} -m pip install -e .[devel]
touch $(VENV_NAME)/bin/activate
lint: venv
${PYTHON} -m pylint --rcfile=.pylintrc *.py ${PROJECT}
${PYTHON} -m pylint --rcfile=.pylintrc *.py examples
${PYTHON} -m mypy --namespace-packages ${PROJECT}
${PYTHON} -m mypy --namespace-packages examples
test: venv
${PYTHON} -m unittest
clean:
find . -name '*.pyc' -delete
rm -rf $(VENV_NAME) *.eggs *.egg-info dist build docs/_build .cache .mypy_cache
build: venv
rm -rf dist/*
${PYTHON} setup.py sdist bdist_wheel
test_upload: build
${PYTHON} -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
upload: build
${PYTHON} -m twine upload dist/*