forked from bmentges/brainiak_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (89 loc) · 4.45 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
CWD="`pwd`"
HOME_BRAINIAK ?= $(CWD)
BRAINIAK_CODE=$(HOME_BRAINIAK)/src
NEW_PYTHONPATH=$(BRAINIAK_CODE):$(PYTHONPATH)
EXTRA_NOSE_PARAMS ?= $(NOSE_PARAMS)
.PHONY: docs
clean:
@find . -name "*.pyc" -delete
@find . -name "__pycache__" -delete
@find . -name "*~" -delete
clean_redis:
@redis-cli FLUSHDB
install:
@echo "Installing dependencies..."
@pip install -r $(HOME_BRAINIAK)/requirements.txt
@pip install -r $(HOME_BRAINIAK)/requirements_test.txt
@pip install -r $(HOME_BRAINIAK)/docs/requirements_doc.txt
@echo "Installing git hook"
@cp ./tools/git-hooks/pre-commit ./.git/hooks/pre-commit
@chmod ug+x ./.git/hooks/pre-commit
tests: clean pep8 pep8_tests
@echo "Running pep8, unit and integration tests..."
@nosetests -s --cover-branches --cover-erase --with-coverage --cover-inclusive --cover-package=brainiak --tests=$(HOME_BRAINIAK)/tests --with-xunit --with-spec --spec-color $(EXTRA_NOSE_PARAMS) --with-stopwatch
unit: clean
@echo "Running unit tests..."
@nosetests -s --cover-branches --cover-erase --with-coverage --cover-inclusive --cover-package=brainiak --tests=$(HOME_BRAINIAK)/tests/unit --with-xunit --with-spec --spec-color $(EXTRA_NOSE_PARAMS) --with-stopwatch --stopwatch-file=.nose-stopwatch-times-unit
integration: clean check_services
@echo "Running integration tests..."
@nosetests -s --cover-branches --cover-erase --with-coverage --cover-inclusive --cover-package=brainiak --tests=$(HOME_BRAINIAK)/tests/integration --with-xunit --with-spec --spec-color $(EXTRA_NOSE_PARAMS) --with-stopwatch --stopwatch-file=.nose-stopwatch-times-integration
acceptance: clean
@echo "Running acceptance tests..."
@nosetests -s --tests=$(HOME_BRAINIAK)/tests/acceptance --with-xunit --with-spec --spec-color $(EXTRA_NOSE_PARAMS)
acceptance_cma: clean
@echo "Running acceptance tests for the CMAaaS..."
@nosetests -s -x --tests=$(HOME_BRAINIAK)/tests/acceptance/cma --with-xunit --with-spec --spec-color $(EXTRA_NOSE_PARAMS)
pep8:
@echo "Checking source-code PEP8 compliance"
@-pep8 $(HOME_BRAINIAK)/src/brainiak --ignore=E501,E126,E127,E128
pep8_tests:
@echo "Checking tests code PEP8 compliance"
@-pep8 $(HOME_BRAINIAK)/tests --ignore=E501,E126,E127,E128
release:
@# Usage: make release type=major message="Integration to ActiveMQ" (other options: minor or micros)
@echo "Tagging new release..."
@git fetch --tags
@cd src; python -c "from brainiak.utils.git import build_next_release_string; print build_next_release_string('$(type)')" > brainiak/version.py
@cd src; git tag `python -c "from brainiak.utils.git import compute_next_git_tag; print compute_next_git_tag('$(type)')"` -m "$(message)"
run: check_services
@echo "Brainiak is alive!"
PYTHONPATH="$(NEW_PYTHONPATH)" python -m brainiak.server
gunicorn:
@echo "Running with gunicorn..."
PYTHONPATH="$(NEW_PYTHONPATH)" gunicorn -k tornado brainiak.server:application -w 10
nginx:
sudo nginx -c $(HOME_BRAINIAK)/config/local/nginx.conf # run on 0.0.0.0:80
test-nginx:
sudo nginx -t -c $(HOME_BRAINIAK)/config/local/nginx.conf
supervisor:
PYTHONPATH="$(NEW_PYTHONPATH)" supervisord -c config/local/supervisord.conf -n -edebug
docs: clean
@echo "Compiling documentation..."
@cd $(HOME_BRAINIAK)/docs; make html
open_docs: docs
@echo "Compiling and opening documentation..."
@cd $(HOME_BRAINIAK)/docs; make open
console:
@echo "Console Python inside Brainiak code (you must be on the correct Virtualenv)"
@PYTHONPATH="$(BRAINIAK_CODE):$(NEW_PYTHONPATH)" python
check_services:
@echo "Check if all services used by Brainiak are up"
@nosetests -s tests/integration/test_services.py
# i18n #0
# If "string" should be translated, wrap it using _("string")
# i18n #1
# Create Brainiak translation template (POT) at locale/brainiak.pot, based on strings wrapped using _()
# Note: run whenever new strings wrapped using _() are added to Brainiak
translate_template:
@xgettext --language=Python --keyword=_ --directory=src --output=locale/brainiak.pot --from-code=UTF-8 `cd src; find . -name "*.py"`
# i18n #2
# Merge translation template (POT) definitions to existing Portuguese translation file (PO)
portuguese_dictionary: translate_template
@msgmerge --update --backup=off locale/pt_BR/LC_MESSAGES/brainiak.po locale/brainiak.pot
# i18n #3
# Translate whatever needs to be translated at brainiak.po file
# i18n #4
# Compile Portuguese translation file (PO) into a .MO file, which is used by Brainiak
# This final .MO file is used by Tornado
compile_portuguese:
@cd locale/pt_BR/LC_MESSAGES; msgfmt brainiak.po -o brainiak.mo