-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
82 lines (64 loc) · 1.81 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
PROJECT_NAME = l2py
PYTHON_VERSION = 3.10
UNAME = $(shell uname)
DOCKER = $(shell which docker)
COMPOSE = $(shell which docker-compose)
POETRY = $(shell which poetry)
PYTHON = $(shell which python$(PYTHON_VERSION))
PWD = $(shell pwd)
REQUIRED_PACKAGES := swig openssl
lint:
- poetry run black . --check
- poetry run isort -c --profile=black .
format:
poetry run black .
poetry run isort --profile=black .
test:
pytest .
#install_requirements:
#ifeq ($(UNAME),Darwin)
# brew install openssl; \
# brew install swig; \
# export LDFLAGS="-L$(brew --prefix openssl)/lib" \
# CFLAGS="-I$(brew --prefix openssl)/include" \
# SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include"
#endif
install:
$(info Installing poetry:)
curl -sSL https://install.python-poetry.org | $(PYTHON) -
@PATH="/root/.local/bin:$(PATH)"
@export PATH
poetry config virtualenvs.in-project true
poetry install
docker-build-common:
cd common && $(DOCKER) build -t $(PROJECT_NAME)_common --no-cache .
docker-build-login:
cd login && $(DOCKER) build -t $(PROJECT_NAME)_login --no-cache .
docker-build-game:
cd game && $(DOCKER) build -t $(PROJECT_NAME)_game --no-cache .
docker-build: docker-build-common docker-build-login docker-build-game
compose-build:
$(COMPOSE) build
compose-exec:
$(COMPOSE) exec $0 poetry exec bin/$1
python:
PYTHONSTARTUP=.pythonrc \
PYTHONPATH=$(PWD):$(PWD)/common:$(PWD)/login:$(PWD)/game \
python $(filter-out $@,$(MAKECMDGOALS))
compose-exec-%:
$(COMPOSE) exec login poetry run $(filter-out $@,$(MAKECMDGOALS))
help:
$(info compose-build)
$(info docker-build-common)
$(info docker-build-data)
$(info docker-build-game)
$(info docker-build-login)
$(info docker-build)
$(info format)
$(info help)
$(info install_requirements)
$(info install)
$(info lint)
$(info python)
$(info test)
@: