1
2prefix = /usr/local
3
4REPO = https://github.com/markokr/rarfile
5NEWS = doc/news.rst
6
7PACKAGE = $(shell python3 setup.py --name)
8VERSION = $(shell python3 setup.py --version)
9RXVERSION = $(shell python3 setup.py --version | sed 's/\./[.]/g')
10TAG = v$(VERSION)
11TGZ = dist/$(PACKAGE)-$(VERSION).tar.gz
12URL = $(REPO)/releases/download/v$(VERSION)/$(PACKAGE)-$(VERSION).tar.gz
13
14all:
15	pyflakes3 rarfile.py
16	tox -e lint
17	tox -e py38-cryptography -- -n auto
18
19install:
20	python setup.py install --prefix=$(prefix)
21
22clean:
23	rm -rf __pycache__ build dist .tox
24	rm -f *.pyc MANIFEST *.orig *.rej *.html *.class test/*.pyc
25	rm -rf doc/_build doc/_static doc/_templates doc/html
26	rm -rf .coverage cover*
27	rm -rf *.egg-info
28	rm -f test/files/*.rar.[pjt]* *.diffs
29
30toxclean: clean
31	rm -rf .tox
32
33ack:
34	for fn in test/files/*.py38-cryptography; do \
35		cp $$fn `echo $$fn | sed 's/[.]py.*/.exp/'` || exit 1; \
36	done
37
38prepare:
39	@echo "Checking version - $(VERSION)"
40	@grep -qE '^\w+ $(RXVERSION)\b' $(NEWS) \
41	|| { echo "Version '$(VERSION)' not in $(NEWS)"; exit 1; }
42	@echo "Checking git repo"
43	@git diff --stat --exit-code || { echo "ERROR: Unclean repo"; exit 1; }
44
45release: prepare
46	git tag $(TAG)
47	git push github $(TAG):$(TAG)
48
49upload:
50	mkdir -p dist && rm -f dist/*
51	cd dist && wget -q $(URL)
52	tar tvf $(TGZ)
53	twine upload $(TGZ)
54
55shownote:
56	awk -v VER="$(VERSION)" -f doc/note.awk $(NEWS) \
57	| pandoc -f rst -t gfm --wrap=none
58
59unrelease:
60	git push github :$(TAG)
61	git tag -d $(TAG)
62
63dist-test:
64	python3 setup.py sdist
65	rm -rf $(PACKAGE)-$(VERSION)
66	tar xf $(TGZ)
67	cd $(PACKAGE)-$(VERSION) && tox
68
69