-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
101 lines (75 loc) · 2.63 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
VIRTUAL_ENV ?= venv
PIP=$(VIRTUAL_ENV)/bin/pip
TOX=`which tox`
PYTHON=$(VIRTUAL_ENV)/bin/python
ISORT=$(VIRTUAL_ENV)/bin/isort
FLAKE8=$(VIRTUAL_ENV)/bin/flake8
PYTEST=$(VIRTUAL_ENV)/bin/pytest
TWINE=`which twine`
SOURCES=src/ tests/
# using full path so it can be used outside the root dir
SPHINXBUILD=$(shell realpath venv/bin/sphinx-build)
DOCS_DIR=doc
PYTHON_MAJOR_VERSION=3
PYTHON_MINOR_VERSION=7
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
DOCKER_IMAGE_LINUX=kivy/qrcode-linux
SYSTEM_DEPENDENCIES= \
libgl1 \
python3.6 \
python$(PYTHON_VERSION) \
tox
all: virtualenv
$(VIRTUAL_ENV):
$(PYTHON_WITH_VERSION) -m venv $(VIRTUAL_ENV)
$(PIP) install Cython==0.28.6
$(PIP) install -r requirements.txt
virtualenv: $(VIRTUAL_ENV)
virtualenv/test: virtualenv
$(PIP) install -r requirements/requirements-test.txt
system_dependencies:
sudo apt update -qq > /dev/null && sudo apt -qq install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES)
run: virtualenv
$(PYTHON) src/kivy_garden/qrcode/qrcode_widget.py
test:
$(TOX)
@if test -n "$$TRAVIS"; then .tox/py$(PYTHON_MAJOR_MINOR)/bin/coveralls; fi; \
pytest: virtualenv/test
PYTHONPATH=src $(PYTEST) --cov src/ --cov-report html tests/
lint/isort-check: virtualenv/test
$(ISORT) --check-only --diff $(SOURCES)
lint/isort-fix: virtualenv/test
$(ISORT) $(SOURCES)
lint/flake8: virtualenv/test
$(FLAKE8) $(SOURCES)
lint: lint/isort-check lint/flake8
docs/clean:
rm -rf $(DOCS_DIR)/build/
docs:
cd $(DOCS_DIR) && SPHINXBUILD=$(SPHINXBUILD) make html
release/clean:
rm -rf dist/ build/
release/build: release/clean virtualenv
$(PYTHON) setup.py sdist bdist_wheel
$(TWINE) check dist/*
release/upload:
$(TWINE) upload dist/*
clean: release/clean docs/clean
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type d -name "*.egg-info" -exec rm -r {} +
clean/all: clean
rm -rf $(VIRTUAL_ENV) .tox/
docker/pull:
docker pull $(DOCKER_IMAGE_LINUX):latest || true
docker/build:
docker build --cache-from=$(DOCKER_IMAGE_LINUX) --tag=$(DOCKER_IMAGE_LINUX) --file=dockerfiles/Dockerfile-linux .
docker/push:
docker push $(DOCKER_IMAGE_LINUX)
docker/run/test: docker/build
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix $(DOCKER_IMAGE_LINUX) 'make test'
docker/run/app: docker/build
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix $(DOCKER_IMAGE_LINUX) 'make run'
docker/run/shell: docker/build
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix -it --rm $(DOCKER_IMAGE_LINUX)