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