forked from python-wells/protobuf-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (35 loc) · 1.17 KB
/
Makefile
File metadata and controls
41 lines (35 loc) · 1.17 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
PYTHON_MODULES := server client
DEFAULT_PYTHON := python3
VIRTUALENV := virtualenv -q --python=$(DEFAULT_PYTHON) --no-download
VENV := .venv
PIP := $(VENV)/bin/pip
PEP8 := $(VENV)/bin/pep8
PYLINT := $(VENV)/bin/pylint
PYTEST := $(VENV)/bin/pytest
PYTHON := $(VENV)/bin/python
REQUIREMENTS := -r requirements.txt
DEV_REQUIREMENTS := -r requirements-dev.txt
default: test
shell:
$(PYTHON) -i
check: test
venv:
test -d $(VENV) || $(VIRTUALENV) $(VENV)
requirements:
$(PIP) install -q -i https://pypi.tuna.tsinghua.edu.cn/simple -f https://emacsos.com/python/packages/ $(REQUIREMENTS) $(DEV_REQUIREMENTS)
bootstrap: venv requirements
test: bootstrap
$(PEP8) --repeat --ignore=E202,E501,E402 --exclude="*_pb2.py" $(PYTHON_MODULES)
$(PYLINT) -E --ignore-patterns=".*_pb2.py" $(PYTHON_MODULES)
$(PYTEST) $(PYTHON_MODULES)
pipfreeze:
$(PIP) freeze
# project specific
build:
protoc -I=server/ --python_out=server/ server/service.proto
protoc -I=client/ --python_out=client/ client/service.proto
run:
env PYTHONPATH=. DEBUG=1 $(PYTHON) server/server.py
client:
env PYTHONPATH=. DEBUG=1 $(PYTHON) client/client.py
.PHONY: default shell check venv requirements bootstrap test build run client