-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
36 lines (27 loc) · 1.29 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
# -*- Makefile -*-
-include $(buildTop)/share/dws/prefix.mk
srcDir ?= .
installTop ?= $(VIRTUAL_ENV)
binDir ?= $(installTop)/bin
PYTHON := $(binDir)/python
installDirs ?= install -d
# Django 1.7,1.8 sync tables without migrations by default while Django 1.9
# requires a --run-syncdb argument.
# Implementation Note: We have to wait for the config files to be installed
# before running the manage.py command (else missing SECRECT_KEY).
RUNSYNCDB = $(if $(findstring --run-syncdb,$(shell cd $(srcDir) && $(PYTHON) manage.py migrate --help 2>/dev/null)),--run-syncdb,)
install::
cd $(srcDir) && $(PYTHON) ./setup.py --quiet \
build -b $(CURDIR)/build install
install-conf:: $(srcDir)/credentials
$(srcDir)/credentials: $(srcDir)/testsite/etc/credentials
[ -f $@ ] || \
SECRET_KEY=`python -c 'import sys ; from random import choice ; sys.stdout.write("".join([choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^*-_=+") for i in range(50)]))'` ; \
sed -e "s,\%(SECRET_KEY)s,$${SECRET_KEY}," $< > $@
initdb: install-conf
-rm -f $(srcDir)/db.sqlite
cd $(srcDir) && $(PYTHON) ./manage.py migrate $(RUNSYNCDB) --noinput
cd $(srcDir) && $(PYTHON) ./manage.py loaddata testsite/fixtures/default-db.json
doc:
$(installDirs) docs
cd $(srcDir) && sphinx-build -b html ./docs $(PWD)/docs