-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
69 lines (53 loc) · 1.75 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
HERE = $(shell pwd)
VENV_CMD := python3 -m venv
VENV_DIR := $(HERE)/.venv
PYTHON := $(VENV_DIR)/bin/python
PYTEST := $(VENV_DIR)/bin/pytest
PYFLAKES := $(VENV_DIR)/bin/pyflakes
PYBLACK := $(VENV_DIR)/bin/black
BUILD_DIRS = bin .build build include lib lib64 man share package *.egg dist *.egg-info .coverage .pytest_cache
DRY ?= true
ifneq ($(DRY),false)
PYBLACK_OPTS := --diff --check
endif
.PHONY: build
build: $(VENV_DIR)
$(PYTHON) -m build
.PHONY: clean
clean: $(VENV_DIR)
find kingpin -type f -name '*.pyc' -exec rm "{}" \;
rm -f kingpin.zip
rm -rf $(BUILD_DIRS)
PATH=$(VENV_DIR)/bin:$(PATH) $(MAKE) -C docs clean
.PHONY: lint
lint: $(VENV_DIR)
$(PYBLACK) $(PYBLACK_OPTS) kingpin
.PHONY: test
test: $(VENV_DIR)
PYTHONPATH=$(HERE) $(PYTEST) --cov=kingpin -v
PYTHONPATH=$(HERE) $(PYFLAKES) kingpin
PYTHONPATH=$(HERE) $(PYTHON) kingpin/bin/deploy.py --dry --script examples/test/sleep.json
PYTHONPATH=$(HERE) $(PYTHON) kingpin/bin/deploy.py --dry --script examples/test/sleep.yaml
.PHONY: pack
pack: kingpin.zip
$(PYTHON) kingpin.zip --help 2>&1 >/dev/null && echo Success || echo Fail
kingpin.zip: $(VENV_DIR)
rm -rf zip
mkdir -p zip
$(PYTHON) -m pip install -r requirements.txt --target ./zip ./
find ./zip -name '*.pyc' -delete
find ./zip -name '*.egg-info' | xargs rm -rf
cd zip; ln -sf kingpin/bin/deploy.py ./__main__.py
cd zip; zip -9mrv ../kingpin.zip .
rm -rf zip
.PHONY: docs
docs: $(VENV_DIR)
PATH=$(VENV_DIR)/bin:$(PATH) $(MAKE) -C docs html
.PHONY: venv
venv: $(VENV_DIR)
$(VENV_DIR): requirements.txt requirements.test.txt
$(VENV_CMD) $(VENV_DIR)
$(PYTHON) -m pip install -U pip setuptools wheel
$(PYTHON) -m pip install -r requirements.test.txt
$(PYTHON) -m pip install -r requirements.txt
touch $(VENV_DIR)