-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
51 lines (37 loc) · 1.2 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
# Base URL for GNMI .proto files
urlbase = https://raw.githubusercontent.com/openconfig/gnmi/master/proto
# GNMI .proto files
gnmiproto = gnmi.proto
extproto = gnmi_ext.proto
# Python interfaces for GRPC, automatically generated from .proto files
gnmistubs = gnmi_pb2.py gnmi_pb2_grpc.py
extstubs = gnmi_ext_pb2.py gnmi_ext_pb2_grpc.py
# GRPC/protobuf compiler command
protoc = python3 -m grpc_tools.protoc --python_out=. --grpc_python_out=. -I.
srcs = faucetagent.py agenttest.py
# Set a default GOPATH if needed for gnmi_* tools used in test
GOPATH ?= $(HOME)/go
all: $(gnmistubs) $(extstubs)
$(gnmiproto):
# We fetch and edit the .proto to avoid a deep directory hierarchy
wget $(urlbase)/gnmi/$@
sed -i $@ -e 's|github.com/openconfig/gnmi/proto/gnmi_ext/||'
$(extproto):
wget $(urlbase)/gnmi_ext/$@
$(gnmistubs): $(gnmiproto) $(extproto)
$(protoc) $<
$(extstubs): $(extproto)
$(protoc) $<
test: all
@echo "* Using GOPATH=$(GOPATH)"
GOPATH=$(GOPATH) PATH=$(GOPATH)/bin:$(PATH) ./agenttest.py -v
codecheck: all
yapf3 -d $(srcs)
flake8 $(srcs)
pylint $(srcs)
pytype $(srcs)
yapf:
yapf3 -i $(srcs)
clean:
rm -rf *.proto *_pb2*.py *.pyc *~ \#*\# testcerts *.log __pycache__ \
*.yaml pytype_output