-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
97 lines (73 loc) · 2.31 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Makefile for uwsgi, because uwsgi sux
# App-specific config
include Makefile.appconfig
APP_MODULE = "app:create()"
PIDFILE = app.pid
VENV_NAME = runtime
UWSGI_LOG = uwsgi.log
# None of your business
BASEDIR = $(shell readlink -f .)
PIDPATH = $(BASEDIR)/$(PIDFILE)
VENV = $(BASEDIR)/$(VENV_NAME)
BIN = $(VENV)/bin/uwsgi
RM = rm -f
ifeq ($(shell which py.test),)
PYTEST = $(VENV)/bin/py.test
else
PYTEST = $(shell which py.test)
endif
.PHONY: clean tests translations-rescan translations-update translations-compile
start: css ensure-stopped
$(BIN) \
--daemonize $(UWSGI_LOG) \
--pidfile $(PIDFILE) \
--http-socket $(BIND) \
--master \
--lazy-apps \
--processes 1 \
--max-requests 500 \
--log-x-forwarded-for \
-H $(VENV) \
-w $(APP_MODULE)
stop:
$(BIN) --stop $(PIDFILE)
while [ ! -z "`pgrep -F $(PIDFILE)`" ]; do sleep .1; done
ensure-stopped:
@if [ -z "`pgrep -F $(PIDFILE)`" ]; then \
exit 0; \
else \
echo "Cowardly refusing to run when another instance is already running."; \
exit 1; \
fi
restart: stop start
clean:
$(RM) static/style.css
$(RM) static/_bootstrap_version.scss
$(RM) messages.pot
$(RM) *.stamp
last-exception:
@sed -nE '/^Traceback/,/^\[pid: /p' $(UWSGI_LOG) | tac | sed '/^Traceback/q' | tac
css: static/style.css
static/_bootstrap_version.scss: static/vendor/bootstrap-sass-official/bower.json
echo "\$$bower-bootstrap-version:" \"$(shell cat static/vendor/bootstrap-sass-official/bower.json | jq -r .version)\" > static/_bootstrap_version.scss
static/style.css: static/style.scss static/_bootstrap_version.scss static/vendor/bootstrap-sass-official/assets/stylesheets/_bootstrap.scss
$(VENV)/bin/sassc -t compressed static/style.scss static/style.css
init-env:
ln -s ../bower_components static/vendor
init-python:
virtualenv --python=python3 --no-site-packages $(VENV_NAME)
$(VENV)/bin/pip install -r requirements.txt
translations-rescan:
# ``Force rescan''.
$(RM) messages.pot
$(MAKE) messages.pot
messages.pot:
$(VENV)/bin/pybabel extract -F babel.cfg -o messages.pot .
translations-update: translations-update.stamp
translations-update.stamp: messages.pot
$(VENV)/bin/pybabel update -i messages.pot -d translations
touch $@
translations-compile: translations-update.stamp
$(VENV)/bin/pybabel compile -d translations
tests:
PYTHONPATH=. $(PYTEST) -vvv tests