-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (48 loc) · 1.99 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
.DEFAULT: help
.PHONY: help bootstrap build lint outdated test testcov testreport upload syncspecs clean
VENV = .venv
PYTHON_BIN ?= python3
PYTHON = $(VENV)/bin/$(PYTHON_BIN)
SPEC_VERSION=48efdd21bc14de16d45ecdda0912e44a3e0086f9
help:
@echo "Please use \`$(MAKE) <target>' where <target> is one of the following:"
@echo " help - show help information"
@echo " bootstrap - setup packaging dependencies and initialize venv"
@echo " build - build project packages"
@echo " lint - inspect project source code for errors"
@echo " outdated - list outdated project requirements"
@echo " test - run project tests"
@echo " testcov - run project tests with coverage file report"
@echo " testreport - run project tests and open HTML coverage report"
@echo " upload - upload built packages to package repository"
@echo " syncspecs - sync ONVIF specs from upstream repository"
@echo " clean - clean up project environment and all the build artifacts"
bootstrap: $(VENV)/bin/activate
$(VENV)/bin/activate:
$(PYTHON_BIN) -m venv $(VENV)
$(PYTHON) -m pip install -U pip==22.3.1 setuptools==65.6.3 wheel==0.38.4
$(PYTHON) -m pip install -e .[dev,test]
build: bootstrap
$(PYTHON) setup.py sdist bdist_wheel
lint: bootstrap
$(PYTHON) -m flake8 aonvif examples tests
outdated: bootstrap
$(PYTHON) -m pip list --outdated --format=columns
test: bootstrap
$(PYTHON) -m pytest
testcov: bootstrap
$(PYTHON) -m pytest --cov-report=xml
testreport: bootstrap
$(PYTHON) -m pytest --cov-report=html
xdg-open htmlcov/index.html
upload: build
$(PYTHON) -m twine upload dist/*
syncspecs:
mkdir -p .specs
wget -P .specs https://github.com/onvif/specs/archive/${SPEC_VERSION}.zip
unzip -f .specs/${SPEC_VERSION}.zip -d .specs
rm -rf aonvif/wsdl/ver10 aonvif/wsdl/ver20
cp -r .specs/specs-${SPEC_VERSION}/wsdl/ver10/ aonvif/wsdl/
cp -r .specs/specs-${SPEC_VERSION}/wsdl/ver20/ aonvif/wsdl/
clean:
rm -rf *.egg-info .eggs .pytest_cache .specs coverage.xml build dist htmlcov $(VENV)