-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
executable file
·66 lines (49 loc) · 1.71 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
NO_COLOR=\033[0m
GREEN_COLOR=\033[32m
RED_COLOR=\033[31m
YELLOW_COLOR=\033[33;01m
PYTHON_OK = $(shell python --version 2> /dev/null | wc -l)
ifneq ('$(PYTHON_OK)', '')
PYTHON = "python"
endif
PYTHON3_OK = $(shell python3 --version 2> /dev/null | wc -l)
ifneq ('$(PYTHON3_OK)', '')
PYTHON = "python3"
endif
ifndef PYTHON
$(error "Couldn't find Python")
endif
LOCALE_DIR = ./locale
all: clean build
build: i18n-compile
@$(PYTHON) magicked_admin/setup.py build -b bin/magicked_admin
@$(PYTHON) admin_patches/setup.py build -b bin/admin_patches
i18n-update:
@pybabel extract admin_patches -o locale/admin_patches.pot
@pybabel init -l en_GB -i locale/admin_patches.pot -d locale -o ./locale/en_GB/LC_MESSAGES/admin_patches.po
@pybabel extract magicked_admin -o locale/magicked_admin.pot
@pybabel init -l en_GB -i locale/magicked_admin.pot -d locale -o ./locale/en_GB/LC_MESSAGES/magicked_admin.po
i18n-compile:
@pybabel compile -d locale -D "magicked_admin"
@pybabel compile -d locale -D "admin_patches"
clean:
-@rm -rf bin
-@rm -rf magicked_admin/conf/*.sqlite
-@rm -rf magicked_admin/conf/magicked_admin.conf
-@rm -rf magicked_admin/conf/magicked_admin.log
-@find . -name '*.pyc' -exec rm -f {} +
-@find . -name '*.pyo' -exec rm -f {} +
run:
-@./bin/magicked_admin/magicked_admin
isort:
@sh -c "isort --recursive ."
pytest:
@echo "\n$(YELLOW_COLOR)Running tests...$(NO_COLOR)\n"
@pytest magicked_admin/tests --cov=magicked_admin
lint:
@echo "$(YELLOW_COLOR)Checking lints...$(NO_COLOR)\n"
@flake8 --ignore F405,F403,W503,F401,F811 --exclude=admin_patches/utils/patch.py && \
echo "$(GREEN_COLOR)success!$(NO_COLOR)" \
|| { echo "$(RED_COLOR)failure!$(NO_COLOR)\n"; exit 1; }
test: lint pytest
.PHONY: build clean