forked from serge-community/zing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (93 loc) · 2.68 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
CWD = $(shell pwd)
SRC_DIR = ${CWD}/pootle
DOCS_DIR = ${CWD}/docs
STATIC_DIR = ${SRC_DIR}/static
# The ASSETS_DIR is where STATIC_ROOT configuration variable
# usually points to (see pootle/settings/10-base.conf)
ASSETS_DIR = ${SRC_DIR}/assets
JS_DIR = ${STATIC_DIR}/js
FORMATS=--formats=bztar
TEST_ENV_NAME = pootle_test_env
POOTLE_CMD = $(shell sh -c "command -v zing")
ifeq ($(POOTLE_CMD),)
POOTLE_CMD=python manage.py
endif
.PHONY: all build clean test pot help docs assets
all: help
build: docs assets
python setup.py sdist ${FORMATS} ${TAIL}
assets:
npm --version
node --version
cd ${JS_DIR} && \
npm cache clear && \
npm install && \
cd ${CWD}
${POOTLE_CMD} compilejsi18n
${POOTLE_CMD} webpack --extra=--display-error-details
mkdir -p ${ASSETS_DIR}
${POOTLE_CMD} collectstatic --noinput --clear -i node_modules -i .tox -i docs ${TAIL}
${POOTLE_CMD} assets build ${TAIL}
chmod 664 ${ASSETS_DIR}/.webassets-cache/*
travis-assets:
npm --version
node --version
if [ -d "${ASSETS_DIR}/.webassets-cache" ]; then \
echo "eating cache - yum!"; \
else \
cd ${JS_DIR} && \
npm install && \
cd ${CWD}; \
${POOTLE_CMD} compilejsi18n; \
${POOTLE_CMD} webpack --dev --nowatch; \
mkdir -p ${ASSETS_DIR}; \
${POOTLE_CMD} collectstatic --noinput --clear -i node_modules -i .tox -i docs ${TAIL}; \
${POOTLE_CMD} assets build ${TAIL}; \
chmod 664 ${ASSETS_DIR}/.webassets-cache/*; \
fi
docs:
# The following creates the HTML docs.
# NOTE: cd and make must be in the same line.
cd ${DOCS_DIR}; make SPHINXOPTS="-W -q -j 4" html ${TAIL}
clean:
npm cache clear
rm -rf ${TEST_ENV_NAME}
test: clean assets
virtualenv ${TEST_ENV_NAME} && \
source ${TEST_ENV_NAME}/bin/activate && \
pip install -r requirements/tests.txt && \
python setup.py test
pot:
@${SRC_DIR}/tools/createpootlepot
linguas:
@${SRC_DIR}/tools/make-LINGUAS.sh 80 > ${SRC_DIR}/locale/LINGUAS
lint: lint-python lint-js lint-css
lint-py: lint-python
lint-python:
flake8 --config=setup.cfg && \
pydocstyle && \
isort --check-only --diff && \
pylint --rcfile=.pylint-travisrc pootle tests pytest_pootle
lint-js:
cd ${JS_DIR} \
&& npm run lint
lint-css:
cd ${JS_DIR} \
&& npm run stylelint
test-js:
cd ${JS_DIR} \
&& npm test
publish-pypi:
python setup.py sdist ${FORMATS} upload
help:
@echo "Help"
@echo "----"
@echo
@echo " assets - collect and rebuild the static assets"
@echo " build - create sdist with required prep"
@echo " docs - build Sphinx docs"
@echo " clean - remove any temporal files"
@echo " test - run test suite"
@echo " pot - update the POT translations templates"
@echo " linguas - update the LINGUAS file with languages over 80% complete"
@echo " publish-pypi - publish on PyPI"