forked from svinota/pyroute2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (123 loc) · 3.04 KB
/
Makefile
File metadata and controls
143 lines (123 loc) · 3.04 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
##
#
# The pyroute2 project is dual licensed, see README.license.md for details
#
#
ifneq ($(strip $(python)),)
forcePython := --force-python ${python}
else
forcePython :=
endif
checkModules ?= ensurepip
python ?= $(shell util/find_python.sh ${checkModules} )
platform := $(shell uname -s)
releaseTag ?= $(shell git describe --tags --abbrev=0 2>/dev/null )
releaseDescription := $(shell git tag -l -n1 ${releaseTag} | sed 's/[0-9. ]\+//')
noxboot ?= ~/.venv-boot
define nox
{\
which nox 2>/dev/null || {\
test -d ${noxboot} && \
{\
. ${noxboot}/bin/activate;\
} || {\
${python} -m venv ${noxboot};\
. ${noxboot}/bin/activate;\
pip install --upgrade pip;\
pip install nox;\
};\
};\
nox ${forcePython} $(1) -- '${noxconfig}';\
}
endef
.PHONY: selftest
selftest:
ifeq ($(strip $(python)),)
@echo No suitable python versions found. checkModules: ${checkModules}
@exit 42
endif
.PHONY: all
all:
@echo targets:
@echo
@echo \* clean -- clean all generated files
@echo \* docs -- generate project docs
@echo \* dist -- create the package file
@echo \* test -- run all the tests
@echo \* install -- install lib into the system or the current virtualenv
@echo \* uninstall -- uninstall lib
@echo
.PHONY: git-clean
git-clean:
git clean -d -f -x
git remote prune origin
git branch --merged | grep -vE '(^\*| master )' >/tmp/merged-branches && \
( xargs git branch -d </tmp/merged-branches ) ||:
.PHONY: clean
clean:
@for i in `ip -o link | awk -F : '($$2 ~ /^ pr/) {print($$2)}'`; do sudo ip link del $$i; done
@rm -rf docs/html
@rm -rf docs/man
@rm -f tests/*.db
@rm -f tests/*.json
@rm -rf dist build MANIFEST
@rm -rf pyroute2.egg-info
@find pyroute2 -name "*pyc" -exec rm -f "{}" \;
@find pyroute2 -name "*pyo" -exec rm -f "{}" \;
@git checkout VERSION 2>/dev/null ||:
.PHONY: VERSION
VERSION:
@${python} util/update_version.py
.PHONY: docs
docs:
$(call nox,-e docs)
.PHONY: lab
lab:
$(call nox,-e lab)
.PHONY: format
format:
$(call nox,-e linter-$(shell basename ${python}))
.PHONY: test nox
test nox: selftest
ifeq ($(platform), Linux)
$(call nox,-e ${session})
else ifeq ($(platform), OpenBSD)
$(call nox,-e openbsd)
else
$(info >> Platform not supported)
endif
.PHONY: upload
upload: dist
$(call nox,-e upload)
.PHONY: release
release: dist
gh release create \
--verify-tag \
--title "${releaseDescription}" \
${releaseTag} \
./dist/*${releaseTag}*
.PHONY: setup
setup: selftest
$(MAKE) VERSION
.PHONY: dist
dist: setup
$(call nox,-e build)
.PHONY: dist-minimal
dist-minimal: setup
$(call nox,-e build_minimal)
.PHONY: install
install: setup
$(MAKE) uninstall
$(MAKE) clean
$(call nox,-e build)
${python} -m pip install dist/pyroute2-*whl ${root}
.PHONY: install-minimal
install-minimal: dist-minimal
${python} -m pip install dist/pyroute2.minimal*whl ${root}
.PHONY: uninstall
uninstall:
${python} -m pip uninstall -y pyroute2
${python} -m pip uninstall -y pyroute2-minimal
.PHONY: audit-imports
audit-imports:
findimports -n pyroute2 2>/dev/null | awk -f util/imports_dict.awk