forked from Exa-Networks/exabgp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (66 loc) · 2.21 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
PYTHON_CMD ?= python3
PIP_CMD ?= pip3
# set local bin in PATH for poetry
export PATH := $(HOME)/.local/bin:$(PATH)
all: init fmt syntax test build clean
# lists all available targets
list:
@sh -c "$(MAKE) -p no_targets__ | \
awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {\
split(\$$1,A,/ /);for(i in A)print A[i]\
}' | grep -v '__\$$' | grep -v 'make\[1\]' | grep -v 'Makefile' | sort"
# required for list
no_targets__:
init:
@echo "Target init"
$(PIP_CMD) show -q poetry || $(PIP_CMD) install --user poetry
poetry install
poetry version --no-ansi
touch init
fmt:
@echo "Target fmt"
poetry run black src tests
poetry.lock:
@echo "Target poetry.lock"
poetry lock
poetry version --no-ansi
test: poetry.lock
@echo "Target test"
./qa/bin/parsing
./qa/bin/functional encoding
./sbin/exabgp decode -c ./etc/exabgp/api-open.conf FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:003C:02:0000001C4001010040020040030465016501800404000000C840050400000064000000002001010101
env exabgp_log_enable=false pytest --cov --cov-reset ./tests/*_test.py
syntax: poetry.lock
@echo "Target syntax"
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --exclude src/exabgp/vendoring/ --exclude build/ --count --select=E9,F63,F7,F82 --show-source --statistics
extra_syntax:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
security: poetry.lock
poetry run bandit -r src
build: poetry.lock
@echo "Target build"
poetry version --no-ansi
poetry build
publish:
@echo "Target publish to pypi"
poetry publish
pex: build
@echo "Target pex"
mkdir -p artifacts/binaries
poetry run dephell deps convert --envs main
poetry run pex exabgp \
--find-links=dist/ \
--entry-point="exabgp.application.main:main" \
--requirement=requirements.txt \
--output-file=artifacts/binaries/exabgp \
--wheel \
--manylinux=manylinux2014
clean:
@echo "Target clean"
git clean -fdx
clean-venv:
@echo "Target clean-venv"
@poetry env remove $$(poetry env list --no-ansi | tail -n 1 | cut -d' ' -f1)
.PHONY: all list test syntax build publish pex clean clean-venv