-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
129 lines (95 loc) · 3.13 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
# django-read-only-admin
# Makefile
.ONESHELL:
PHONY: install tox test makemessages compilemessages bumpversion build sign check check-build check-upload upload clean coveralls release help
TEST_PYPI_URL ?= https://test.pypi.org/legacy/
NAME ?= read_only_admin
EXTENSIONS ?= py,html,txt,xml
TRASH_DIRS ?= build dist *.egg-info .tox .mypy_cache .pytest_cache __pycache__ htmlcov
TRASH_FILES ?= .coverage
BUILD_TYPES ?= bdist_wheel sdist
VERSION ?= `python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); print(config['metadata']['version']);"`
install:
pip install .[test];\
tox:
tox;\
test:
bash -c 'PYTHONPATH="$${PYTHONPATH}:$${PWD}" py.test --cov=$(NAME) --modules-durations=0 --functions-durations=0 --instafail $(TESTS)';\
makemessages:
for locale in `ls $(NAME)/locale`; do\
django-admin makemessages --locale=$${locale} --extension=$(EXTENSIONS);\
done;\
compilemessages:
django-admin compilemessages;\
bumpversion:
git tag -a $(VERSION) -m "v$(VERSION)";\
build:
python setup.py $(BUILD_TYPES);\
sign:
for package in `ls dist`; do\
gpg -a --detach-sign dist/$${package};\
done;\
check:
bash -c 'NAME="$(NAME)" pre-commit run --all-files';\
check-build:
twine check dist/*;\
check-upload:
twine upload --skip-existing -s --repository-url $(TEST_PYPI_URL) -u __token__ -p $${TEST_TWINE_PASSWORD} dist/*;\
upload:
twine upload --skip-existing -s dist/*;\
clean:
for file in $(TRASH_FILES); do\
find -iname $${file} -print0 | xargs -0 rm -rf;\
done;\
for dir in $(TRASH_DIRS); do\
find -type d -name $${dir} ! -path "*/.direnv/*" -print0 | xargs -0 rm -rf;\
done;\
coveralls:
coveralls;\
release:
make clean && \
make bumpversion && \
git co master && \
git merge dev && \
git co dev && \
git push --all && \
git push --tags && \
make build && \
make sign && \
make check-build && \
make check-upload && \
make upload && \
make clean;\
help:
@echo " help:"
@echo " Show this help."
@echo " install:"
@echo " Install requirements."
@echo " tox:"
@echo " Run tox."
@echo " test:"
@echo " Run tests, can specify tests with 'TESTS' variable."
@echo " makemessages:"
@echo " Harvest translations."
@echo " compilemessages:"
@echo " Compile translations."
@echo " bumpversion:"
@echo " Tag current code revision with version."
@echo " build:"
@echo " Build python packages, can specify packages types with 'BUILD_TYPES' variable."
@echo " sign:"
@echo " Sign python packages."
@echo " check:"
@echo " Perform some code checks."
@echo " check-build:"
@echo " Run twine checks."
@echo " check-upload:"
@echo " Upload package to test PyPi using twine."
@echo " upload:"
@echo " Upload package to PyPi using twine."
@echo " clean:"
@echo " Recursively delete useless autogenerated files and directories, directories and files lists can be overriden through 'TRASH_DIRS' and 'TRASH_FILES' variables."
@echo " coveralls:"
@echo " Upload coverage report to Coveralls."
@echo " release:"
@echo " Release code."