-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
164 lines (136 loc) · 6.11 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
.PHONY: upgrade_setuptools install install_dev install_nth test test_v test_ff test_vff settings help
.SILENT: epr coverage clean
EPR_HOME = src
# -----------------------------------------------------------------------------
# abk_epr Makefile rules
# -----------------------------------------------------------------------------
epr:
echo "[ python ./src/abk_epr.py -d ./data/20230725_mixed_img -c ./src/logging.yaml -v ]"
echo "------------------------------------------------------------------------------------"
cd $(EPR_HOME) && python abk_epr.py -d ../data/20230725_mixed_img -c logging.yaml -v
epr_log:
cd $(EPR_HOME) && python abk_epr.py -d ../data/20230725_mixed_img -c logging.yaml -l -v
epr_trace:
cd $(EPR_HOME) && python abk_epr.py -d ../data/20230725_mixed_img -c logging.yaml -v
epr_clean:
cd $(EPR_HOME) && rm -Rf ../data/20230725_mixed_img && cp -R ../data/20230725_mixed_img_backup ../data/20230725_mixed_img
# -----------------------------------------------------------------------------
# Dependency installation Makefile rules
# -----------------------------------------------------------------------------
upgrade_setuptools:
pip install --upgrade setuptools
install: upgrade_setuptools
pip install --requirement requirements.txt
install_test: upgrade_setuptools
pip install --requirement requirements_test.txt
install_dev: upgrade_setuptools
pip install --requirement requirements_dev.txt
# -----------------------------------------------------------------------------
# Running tests Makefile rules
# -----------------------------------------------------------------------------
test:
python -m unittest discover --start-directory tests
test_ff:
python -m unittest discover --start-directory tests --failfast
test_v:
python -m unittest discover --start-directory tests --verbose
test_vff:
python -m unittest discover --start-directory tests --verbose --failfast
%:
@:
test_1:
python -m unittest "tests.$(filter-out $@,$(MAKECMDGOALS))"
coverage:
coverage run --source $(EPR_HOME) --omit ./tests/*,./$(EPR_HOME)/config/* -m unittest discover --start-directory tests
@echo
coverage report
coverage xml
# coverage:
# coverage run --source src --omit src/__init__.py -m unittest discover --start-directory tests
# @echo
# coverage report
# coverage xml
# -----------------------------------------------------------------------------
# Package bulding and deploying Makefile rules
# -----------------------------------------------------------------------------
sdist: upgrade_setuptools
@echo "[ python setup.py sdist ]"
@echo "------------------------------------------------------------------------------------"
python setup.py sdist
build: upgrade_setuptools
@echo "[ python -m build ]"
@echo "------------------------------------------------------------------------------------"
python -m build
wheel: upgrade_setuptools
@echo "[ python -m build ]"
@echo "------------------------------------------------------------------------------------"
python -m build --wheel
testpypi: wheel
@echo "[ twine upload -r testpypi dist/*]"
@echo "------------------------------------------------------------------------------------"
twine upload -r testpypi dist/*
pypi: wheel
@echo "[ twine upload -r pypi dist/* ]"
@echo "------------------------------------------------------------------------------------"
twine upload -r pypi dist/*
# -----------------------------------------------------------------------------
# Clean up Makefile rules
# -----------------------------------------------------------------------------
clean:
@echo "deleting log files:"
@echo "___________________"
@if [ -f logs/* ]; then ls -la logs/*; fi;
@if [ -f logs/* ]; then rm -rf logs/*; fi;
@echo
@echo "deleting dist files:"
@echo "___________________"
@if [ -d dist ]; then ls -la dist; fi;
@if [ -d dist ]; then rm -rf dist; fi;
@echo
@echo "deleting build files:"
@echo "___________________"
@if [ -d build ]; then ls -la build; fi;
@if [ -d build ]; then rm -rf build; fi;
@echo
@echo "deleting egg-info files:"
@echo "___________________"
@if [ -d *.egg-info ]; then ls -la *.egg-info; fi
@if [ -d *.egg-info ]; then rm -rf *.egg-info; fi
@echo
@echo "deleting __pycache__ directories:"
@echo "___________________"
find . -name "__pycache__" -type d -prune
rm -rf $(find . -name "__pycache__" -type d -prune)
# ----------------------------
# those rules should be universal
# ----------------------------
settings:
@echo "HOME = ${HOME}"
@echo "PWD = ${PWD}"
@echo "SHELL = ${SHELL}"
help:
@echo "Targets:"
@echo "--------------------------------------------------------------------------------"
@echo " epr - executes the main program to rename images"
@echo "--------------------------------------------------------------------------------"
@echo " install - installs required packages"
@echo " install_test - installs required test packages"
@echo " install_dev - installs required development packages"
@echo "--------------------------------------------------------------------------------"
@echo " test - runs test"
@echo " test_v - runs test with verbose messaging"
@echo " test_ff - runs test fast fail"
@echo " test_vff - runs test fast fail with verbose messaging"
@echo " test_1 <file.class.test> - runs a single test"
@echo " coverage - runs test, produces coverage and displays it"
@echo "--------------------------------------------------------------------------------"
@echo " clean - cleans some auto generated build files"
@echo "--------------------------------------------------------------------------------"
@echo " sdist - builds sdist for pypi"
@echo " sdist - creates build"
@echo " wheel - creates wheel build"
@echo " testpypi - uploads build to testpypi"
@echo " pypi - uploads build to pypi"
@echo "--------------------------------------------------------------------------------"
@echo " settings - outputs current settings"
@echo " help - outputs this info"