summaryrefslogtreecommitdiff
path: root/Makefile
blob: 440ec3db32b428bfafa43f1b599dcc94eaf48391 (plain)
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
#
# Options
#

PYTHON = python

#
# Interesting targets
#

.PHONY: all
all:
	@echo "There's nothing that needs building.  Just run ./gtimelog"

.PHONY: check test
check test:
	./runtests

.PHONY: coverage
coverage:
	coverage run ./runtests
	coverage report --include 'src/gtimelog/*'

.PHONY: clean
clean:
	rm -rf temp tmp build gtimelog.egg-info
	find -name '*.pyc' -delete

.PHONY: dist
dist:
	$(PYTHON) setup.py sdist

.PHONY: distcheck
distcheck: check dist
	pkg_and_version=`$(PYTHON) setup.py --name`-`$(PYTHON) setup.py --version` && \
	rm -rf tmp && \
	mkdir tmp && \
	bzr export tmp/tree && \
	cd tmp && \
	tar xvzf ../dist/$$pkg_and_version.tar.gz && \
	diff -ur $$pkg_and_version tree -x PKG-INFO -x setup.cfg -x '*.egg-info' && \
	cd $$pkg_and_version && \
	make dist check && \
	cd .. && \
	mkdir one two && \
	cd one && \
	tar xvzf ../../dist/$$pkg_and_version.tar.gz && \
	cd ../two/ && \
	tar xvzf ../$$pkg_and_version/dist/$$pkg_and_version.tar.gz && \
	cd .. && \
	diff -ur one two -x SOURCES.txt && \
	cd .. && \
	rm -rf tmp && \
	echo "sdist seems to be ok"
# I'm ignoring SOURCES.txt since it appears that the second sdist gets a new
# source file, namely, setup.cfg.  Setuptools/distutils black magic, may it rot
# in hell forever.

.PHONY: releasechecklist
releasechecklist:
	@$(PYTHON) setup.py --version | grep -qv dev || { \
	    echo "Please remove the 'dev' suffix from the version number in src/gtimelog/__init__.py"; exit 1; }
	@$(PYTHON) setup.py --long-description | rst2html --exit-status=2 > /dev/null
	@ver_and_date="`$(PYTHON) setup.py --version` (`date +%Y-%m-%d`)" && \
	    grep -q "^$$ver_and_date$$" NEWS.txt || { \
	        echo "NEWS.txt has no entry for $$ver_and_date"; exit 1; }
	# Bit of a chicken-and-egg here, but if the tree is unclean, make
	# distcheck will fail.  Thankfully bzr lets me uncommit.
	@test -z "`bzr status 2>&1`" || { echo; echo "Your working tree is not clean" 1>&2; bzr status; exit 1; }
	make distcheck

.PHONY: release
release: releasechecklist
	# I'm chicken so I won't actually do these things yet
	@echo "Please run"
	@echo
	@echo "  $(PYTHON) setup.py sdist register upload && bzr tag `$(PYTHON) setup.py --version`"
	@echo
	@echo "Please increment the version number in src/gtimelog/__init__.py"
	@echo "and add a new empty entry at the top of NEWS.txt, then"
	@echo
	@echo '  bzr ci -m "Post-release version bump" && bzr push'
	@echo