-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathMakefile
120 lines (95 loc) · 2.88 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
URI1 = otpauth://totp/alice:bob?secret=ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS
URI2 = otpauth://totp/alice:cam?secret=PW4YAYYZVDE5RK2AOLKUATNZIKAFQLZO&issuer=alice
help:
@echo 'Release Checklist'
@echo '================='
@echo
@echo 'vim setup.py # Update version'
@echo 'vim CHANGES.md # Update changelog'
@echo
@echo 'make checks'
@echo 'make dist test-upload verify-test-upload'
@echo 'open https://test.pypi.org/project/mintotp/'
@echo
@echo 'git add .'
@echo 'git status'
@echo 'git commit'
@echo 'git push origin main'
@echo
@echo 'make upload verify-upload'
@echo 'open https://pypi.org/project/mintotp/'
@echo
@echo "VER=$$(grep version setup.py | cut -d\' -f2)"
@echo 'git tag $$VER -m "MinTOTP $$VER"'
@echo 'git push origin $$VER'
@echo
# Development.
rmvenv:
rm -rf ~/.venv/mintotp venv
venv: FORCE
python3 -m venv ~/.venv/mintotp
echo . ~/.venv/mintotp/bin/activate > venv
deps:
touch venv
. ./venv && pip3 install -U importlib-metadata
. ./venv && \
pip3 install pylama pylama-pylint coverage wheel twine coveralls
test:
python3 -m unittest -v
coverage:
. ./venv && coverage run -m unittest -v
. ./venv && coverage report --show-missing
. ./venv && coverage html
lint:
. ./venv && isort --quiet --diff .
. ./venv && pylama \
-l pycodestyle,pyflakes,mccabe,pylint,isort \
-i C0111,C0103,R0201
checks: lint test coverage dist
# Helpers.
qr:
qrencode -s 10 -o secret1.png "$(URI1)"
qrencode -s 10 -o secret2.png "$(URI2)"
key:
python3 -c \
'import base64, os; print(base64.b32encode(os.urandom(20)).decode())'
# Package and distribute.
dist: clean
. ./venv && python3 setup.py sdist bdist_wheel
. ./venv && twine check dist/*
unzip -c dist/*.whl */METADATA
upload:
. ./venv && twine upload dist/*
test-upload:
. ./venv && twine upload --repository-url \
https://test.pypi.org/legacy/ dist/*
# Test distributions.
user-venv: FORCE
rm -rf ~/.venv/test-mintotp user-venv
python3 -m venv ~/.venv/test-mintotp
echo . ~/.venv/test-mintotp/bin/activate > user-venv
verify-upload:
$(MAKE) verify-sdist
$(MAKE) verify-bdist
verify-test-upload:
$(MAKE) verify-test-sdist
$(MAKE) verify-test-bdist
verify-sdist: user-venv
. ./user-venv && pip3 install --no-binary :all: mintotp
. ./user-venv && echo ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS | mintotp
verify-bdist: user-venv
. ./user-venv && pip3 install mintotp
. ./user-venv && echo ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS | mintotp
verify-test-sdist: user-venv
. ./user-venv && pip3 install \
--index-url https://test.pypi.org/simple/ --no-binary :all: mintotp
. ./user-venv && echo ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS | mintotp
verify-test-bdist: user-venv
. ./user-venv && pip3 install \
--index-url https://test.pypi.org/simple/ mintotp
. ./user-venv && echo ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS | mintotp
clean:
rm -rf *.pyc __pycache__
rm -rf .coverage htmlcov
rm -rf build dist mintotp.egg-info
FORCE: