-
Notifications
You must be signed in to change notification settings - Fork 9
/
makefile
51 lines (36 loc) · 2.08 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
PYTHON := python
LANGUAGES := fi en
# Optionally include user variables.
sinclude makevars
MM_ARGS = $(foreach lang, ${LANGUAGES}, -l ${lang}) -i KirppuVenv -i node_modules --no-location $(foreach ignore, ${MM_IGNORES}, -i ${ignore})
# Prefix for some commands to use when not run in activated virtualenv.
ifeq ($(origin VIRTUAL_ENV), undefined)
PFX := ./KirppuVenv/bin/
endif
default: help
messages: ## Extract strings from sources for localization.
DEBUG=1 ${PFX}${PYTHON} manage.py makemessages -d djangojs ${MM_ARGS}
DEBUG=1 ${PFX}${PYTHON} manage.py makemessages -d django ${MM_ARGS}
static: ## Install npm dependencies and build static files.
cd kirppu && npm i && npm run build
compile: ## Compile localizations for use.
DEBUG=1 ${PFX}${PYTHON} manage.py compilemessages
c: ## Clean compiled pyc files.
find kirppu -name \*.pyc -exec rm {} +
find kirppuauth -name \*.pyc -exec rm {} +
find kirppu_project -name \*.pyc -exec rm {} +
cloc: ## Count project lines using cloc.
cloc --git HEAD --exclude-ext=po
apistub: ## Create/update ajax_api stub file helping navigation from frontend code to backend.
find kirppu -! -path "kirppu/node_modules*" -name \*.py -exec python3 make_api_stub.py --js kirppu/static_src/js/api_stub.js --py kirppu/tests/api_access.pyi -- {} +
test: ## Run tests
DEBUG=1 ${PFX}py.test -vvv
update-constraints: ## Update constraints.txt to match pyproject.toml
${PFX}pip-compile --all-extras --output-file=constraints.txt --strip-extras --upgrade
test constraints.txt -ef requirements-github.txt || ln -f constraints.txt requirements-github.txt || cp constraints.txt requirements-github.txt
requirement-sets: ## Generate requirements-* files.
${PFX}${PYTHON} scripts/generate-dep-set.py --extra dev -o "requirements-dev.txt"
${PFX}${PYTHON} scripts/generate-dep-set.py --extra oauth --extra production -o "requirements-production.txt"
help: ## This help.
@grep -F -h "#""#" $(MAKEFILE_LIST) | sed -e "s/:\\s*#""#/\n\t/" -e "s/\\s*#""#/\t/"
.PHONY: apistub c cloc compile default help messages requirement-sets static test update-constraints