-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (42 loc) · 1.48 KB
/
Makefile
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
59
ifdef CMD
DOCKER_CMD=$(CMD)
else
DOCKER_CMD=/bin/bash
endif
DOCKER_RUN_COMMAND=docker-compose -f tools/compose-config.yml run dev_pyprometheus
default: help
include tools/Makefile
version := $(shell sh -c "egrep -oe '__version__\s+=\s+(.*)' ./pyprometheus/__init__.py | sed 's/ //g' | sed \"s/'//g\" | sed 's/__version__=//g'")
#version := $(shell sh -c "$(DOCKER_RUN_COMMAND) 'python setup.py --version'")
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name "__pycache__" -exec rm -rf {} +
clean-dist:
rm -rf dist/*
rm -rf build/*
help:
@echo "Available commands:"
@sed -n '/^[a-zA-Z0-9_.]*:/s/:.*//p' <Makefile | sort
release:
git tag -f v$(version) && git push origin v$(version)
publish: clean-pyc clean-dist
@echo "Create release $(version) and upload to pypi"
$(DOCKER_RUN_COMMAND) "python setup.py sdist bdist_wheel"
$(DOCKER_RUN_COMMAND) 'for d in dist/* ; do twine register "$$d"; done;'
$(DOCKER_RUN_COMMAND) "twine upload dist/*"
@echo ""
test: clean-containers
@echo "Test application $(version)"
$(DOCKER_RUN_COMMAND) "uwsgi --pyrun setup.py --pyargv test --sharedarea=100 --enable-threads"
@echo ""
tox: clean-containers
@echo "Tox test application $(version)"
$(DOCKER_RUN_COMMAND) "tox"
@echo ""
lint: clean-containers
@echo "Linting python files"
$(DOCKER_RUN_COMMAND) "PYFLAKES_NODOCTEST=1 flake8 pyprometheus" || exit 1
@echo ""
.PHONY: test publish lint help clean-pyc tox