-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (32 loc) · 1.04 KB
/
Makefile
File metadata and controls
42 lines (32 loc) · 1.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
export PYTHONPATH := $(shell pwd)
ARGS ?=
VENV_PYTHON := .venv/bin/python
THRIFT_DIR = ThriftTsConfig/schema
THRIFT_ROOT_FILE = $(THRIFT_DIR)/config.thrift
PROTO_DIR = src/proto
GEN_DIR = src/backend/generated
PROTO_GEN_DIR = $(GEN_DIR)/proto
THRIFT_GEN_DIR = $(GEN_DIR)/thrift
THRIFT_TS_SCHEMA_GEN_DIR = $(THRIFT_GEN_DIR)/ts_schema
PROTO_PY_GEN_DIR = $(PROTO_GEN_DIR)/python
prep-project:
if [ ! -d ".venv" ]; then \
python3 -m venv .venv; \
fi
.venv/bin/pip install -r requirements.txt
generate-proto-python:
mkdir -p $(PROTO_PY_GEN_DIR)
protoc -I=$(PROTO_DIR) \
--python_out=$(PROTO_PY_GEN_DIR) \
--pyi_out=$(PROTO_PY_GEN_DIR) \
$(shell find $(PROTO_DIR) -name "*.proto")
.venv/bin/fix-protobuf-imports $(PROTO_PY_GEN_DIR)
thrift-to-py:
mkdir -p $(THRIFT_GEN_DIR)
thrift -r --gen py:type_hints,enum,package_prefix=backend.generated.thrift. \
-I $(THRIFT_DIR) \
-out $(THRIFT_GEN_DIR) \
$(THRIFT_ROOT_FILE);
generate: generate-proto-python thrift-to-py
deploy-backend:
PYTHONPATH="$(PWD)/src" $(VENV_PYTHON) -m backend.deploy