1
1
PROJECT_NAME := $(shell basename $CURDIR)
2
- VIRTUAL_ENVIRONMENT := $(CURDIR ) /.venv
3
- LOCAL_PYTHON := $(VIRTUAL_ENVIRONMENT ) /bin/python3
2
+ VIRTUAL_ENV := $(CURDIR ) /.venv
3
+ LOCAL_PYTHON := $(VIRTUAL_ENV ) /bin/python3
4
4
5
5
define HELP
6
6
Manage $(PROJECT_NAME ) . Usage:
@@ -19,63 +19,52 @@ export HELP
19
19
20
20
.PHONY : run install deploy update format lint clean help
21
21
22
-
23
22
all help :
24
23
@echo " $$ HELP"
25
24
25
+ env : $(VIRTUAL_ENV )
26
26
27
- env : $(VIRTUAL_ENVIRONMENT )
28
-
29
-
30
- $(VIRTUAL_ENVIRONMENT ) :
31
- if [ -d $( VIRTUAL_ENVIRONMENT) ]; then \
32
- @echo " Creating Python virtual environment..." && \
33
- python3 -m venv $(VIRTUAL_ENVIRONMENT ) && \
27
+ $(VIRTUAL_ENV ) :
28
+ if [ ! -d $( VIRTUAL_ENV) ]; then \
29
+ echo " Creating Python virtual env in \` ${VIRTUAL_ENV} \` " ; \
30
+ python3 -m venv $(VIRTUAL_ENV ) ; \
34
31
fi
35
32
36
-
37
33
.PHONY : run
38
34
run : env
39
- $(shell python3 -m wsgi.py)
40
-
35
+ $(LOCAL_PYTHON ) -m main
41
36
42
37
.PHONY : install
43
- install :
44
- if [ ! -d " ./.venv" ]; then python3 -m venv $( VIRTUAL_ENVIRONMENT) ; fi
45
- $(shell . .venv/bin/activate)
46
- $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel
47
- $(LOCAL_PYTHON ) -m pip install -r requirements.txt
48
-
38
+ install : env
39
+ $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel && \
40
+ $(LOCAL_PYTHON ) -m pip install -r requirements.txt && \
41
+ npm i -g less && \
42
+ echo Installed dependencies in \` ${VIRTUAL_ENV} \` ;
49
43
50
44
.PHONY : deploy
51
45
deploy :
52
- make clean
53
- make install
46
+ make install && \
54
47
make run
55
48
56
-
57
49
.PHONY : test
58
50
test : env
59
51
$(LOCAL_PYTHON ) -m \
60
- coverage run -m pytest -v \
61
- --disable-pytest-warnings \
62
- && coverage html --title=' Coverage Report' -d .reports \
63
- && open .reports/index.html
64
-
52
+ coverage run -m pytest -vv \
53
+ --disable-pytest-warnings && \
54
+ coverage html --title=' Coverage Report' -d .reports && \
55
+ open .reports/index.html
65
56
66
57
.PHONY : update
67
- update :
68
- if [ ! -d " ./.venv" ]; then python3 -m venv $( VIRTUAL_ENVIRONMENT) ; fi
69
- $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel
70
- poetry update
71
- poetry export -f requirements.txt --output requirements.txt --without-hashes
72
-
58
+ update : env
59
+ $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel && \
60
+ poetry update && \
61
+ poetry export -f requirements.txt --output requirements.txt --without-hashes && \
62
+ echo Installed dependencies in \` ${VIRTUAL_ENV} \` ;
73
63
74
64
.PHONY : format
75
65
format : env
76
- isort --multi-line=3 .
77
- black .
78
-
66
+ $(LOCAL_PYTHON ) -m isort --multi-line=3 . && \
67
+ $(LOCAL_PYTHON ) -m black .
79
68
80
69
.PHONY : lint
81
70
lint : env
@@ -85,19 +74,20 @@ lint: env
85
74
--show-source \
86
75
--statistics
87
76
88
-
89
77
.PHONY : clean
90
78
clean :
91
- find . -name ' *.pyc' -delete
92
- find . -name ' __pycache__' -delete
93
- find . -name ' poetry.lock' -delete
94
- find . -name ' Pipefile.lock' -delete
95
- find . -name ' *.log' -delete
96
- find . -name ' .coverage' -delete
97
- find . -wholename ' logs/*.json' -delete
98
- find . -wholename ' */.pytest_cache' -delete
99
- find . -wholename ' **/.pytest_cache' -delete
100
- find . -wholename ' ./logs/*.json' -delete
101
- find . -wholename ' .webassets-cache/*' -delete
102
- find . -wholename ' ./logs' -delete
103
- find . -wholename ' ./.reports' -delete
79
+ find . -name ' .coverage' -delete && \
80
+ find . -name ' *.pyc' -delete \
81
+ find . -name ' __pycache__' -delete \
82
+ find . -name ' poetry.lock' -delete \
83
+ find . -name ' *.log' -delete \
84
+ find . -name ' .DS_Store' -delete \
85
+ find . -wholename ' **/*.pyc' -delete && \
86
+ find . -wholename ' **/*.html' -delete && \
87
+ find . -type d -wholename ' __pycache__' -exec rm -rf {} + && \
88
+ find . -type d -wholename ' .venv' -exec rm -rf {} + && \
89
+ find . -type d -wholename ' .pytest_cache' -exec rm -rf {} + && \
90
+ find . -type d -wholename ' **/.pytest_cache' -exec rm -rf {} + && \
91
+ find . -type d -wholename ' **/*.log' -exec rm -rf {} + && \
92
+ find . -type d -wholename ' ./.reports/*' -exec rm -rf {} + && \
93
+ find . -type d -wholename ' **/.webassets-cache' -exec rm -rf {} +
0 commit comments