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
|
##
#
# The pyroute2 project is dual licensed, see README.license.md for details
#
#
python ?= $(shell util/find_python.sh)
platform := $(shell uname -s)
releaseTag ?= $(shell git describe --tags --abbrev=0)
releaseDescription := $(shell git tag -l -n1 ${releaseTag} | sed 's/[0-9. ]\+//')
define nox
{\
which nox 2>/dev/null || {\
${python} -m venv ~/.venv-boot/;\
. ~/.venv-boot/bin/activate;\
pip install --upgrade pip;\
pip install nox;\
};\
nox $(1) -- '${noxconfig}';\
}
endef
.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:
@rm -f lab/*html
@rm -f lab/_static/conf.js
@rm -rf lab/_build
@rm -rf docs/html
@rm -rf docs/man
@rm -rf dist build MANIFEST
@rm -f docs-build.log
@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)
.PHONY: test
test:
ifeq ($(platform), Linux)
$(call nox,)
else ifeq ($(platform), OpenBSD)
$(call nox,-e openbsd)
else
$(info >> Platform not supported)
endif
.PHONY: test-platform
test-platform:
$(call nox,-e test_platform)
.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:
$(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
.PHONY: nox
nox:
$(call nox,-e ${session})
|