VER_PYTHON VER_MYSQL_PYTHON VER_NOSE 10 VER_DJANGO VER_SOUTH VER_IMAGE

 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
VER_PYTHON = 2.5
VER_MYSQL_PYTHON = 1.2.2
VER_NOSE = 0.10.1
VER_DJANGO = 1.0.2
VER_SOUTH = 0.4
VER_IMAGE_LIB = 1.1.6
PACKAGES = \
Django==$(VER_DJANGO) \
MySQL_python==$(VER_MYSQL_PYTHON) \
South==$(VER_SOUTH) \
Imaging==$(VER_IMAGE_LIB) \
nose==$(VER_NOSE) \
SYSTEM_PYTHON = python$(VER_PYTHON)
ROOT = $(shell pwd)
SANDBOX = ./.sandbox
PACKAGESDIR = $(ROOT)/eggs
BIN = $(SANDBOX)/bin
INSTALL = $(BIN)/easy_install-$(VER_PYTHON)
PYTHON = $(BIN)/python$(VER_PYTHON)
DJANGOADMIN = $(BIN)/django-admin.py
.PHONY: all help check_requirenments sandbox test-model test-web
all: help
help:
@echo "Use:"
@echo " make run Run development version (implies creating environment)."
@echo " make clean Remove python environment."
@echo "test:"
@echo " make test-model Run model tests."
@echo " make test-web Run web tests."
check_requirements:
@which $(SYSTEM_PYTHON) >/dev/null || \
{ echo "FATAL: No $(SYSTEM_PYTHON) found"; exit 1;}
@$(SYSTEM_PYTHON) -V 2>&1 | grep -q "^Python $(VER_PYTHON)" || \
{ echo "FATAL: $(SYSTEM_PYTHON) version should be $(VER_PYTHON) (see $(SYSTEM_PYTHON) -v)."; exit 1;}
@which $(SYSTEM_PYTHON)-config >/dev/null || \
{ echo "FATAL: No $(SYSTEM_PYTHON)-config found. Try install package python2.5-dev or something with python headers."; exit 1;}
@which mysql_config >/dev/null || \
{ echo "FATAL: No mysql_config found. Install MySQL headers (package name in Ubuntu: libmysqlclient15-dev)."; exit 1;}
.made-sandbox:
@rm -rf $(SANDBOX) .made-sandbox
$(SYSTEM_PYTHON) $(PACKAGESDIR)/virtualenv.py -q --no-site-packages $(SANDBOX)
$(INSTALL) -H None -f $(PACKAGESDIR) $(PACKAGES)
sed -i 's/encoding = "ascii"/encoding = "utf-8"/' $(SANDBOX)/lib/python$(VER_PYTHON)/site.py
# Move python imaging library to from PIL-1.1.6-py2.5-linux-i686.egg to PIL directory
mv $(SANDBOX)/lib/python$(VER_PYTHON)/site-packages/PIL-1.1.6-py2.5-linux-i686.egg $(SANDBOX)/lib/python$(VER_PYTHON)/site-packages/PIL
touch .made-sandbox
sandbox: check_requirements .made-sandbox
clean:
rm -rf $(SANDBOX)
rm -f .made-sandbox
run: sandbox i18n-compile
$(PYTHON) schoolplaces/manage.py runserver
sync: sandbox
$(PYTHON) schoolplaces/manage.py syncdb
migrate: sandbox
$(PYTHON) schoolplaces/manage.py migrate
test-model: sandbox
test-web: sandbox
i18n-makemessages: sandbox
cd schoolplaces && .$(PYTHON) manage.py makemessages --all -l ru_RU
i18n-compile: sandbox
cd schoolplaces && .$(PYTHON) manage.py compilemessages