Use the more modernly Pythonic .get() for dict values
[syboa:syboa.git] / Makefile
1 #
2 # Makefile for pymnl
3 #
4
5 SHELL = /bin/sh
6
7 package = syboa
8
9 srcdir = .
10
11 VERSION = $(shell cat $(srcdir)/docs/VERSION)
12
13 BRANCH = "master"
14
15 TOPDIR := $(CURDIR)
16
17 TESTCASES = ./syboa/tests/
18
19 COVERAGE2=coverage-py2.7
20
21 .PHONY: all install test sdist tarball clean distclean
22
23 all:
24         PYTHONPATH=. python ./setup.py build
25
26 install:
27         PYTHONPATH=. python ./setup.py install
28
29 test:   test2
30
31 test2:
32         PYTHONPATH=. python ./setup.py test --verbose \
33                 --start-dir=$(TESTCASES) --pattern='*.py'
34
35 testcoverage:   testcoverage2
36         $(COVERAGE2) combine
37         $(COVERAGE2) html
38
39 testcoverage2:
40         @which $(COVERAGE2) > /dev/null 2>&1 || \
41                 (echo "Code coverage for Python 2 not found" && exit 1)
42         PYTHONPATH=. $(COVERAGE2) run --parallel-mode --branch \
43                 --omit="*testcommand*" \
44                 ./setup.py test --test-list $(TESTCASES) --test-verbose
45
46 sdist:  $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sha256 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sign
47
48 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2:
49         PYTHONPATH=. python ./setup.py sdist --force-manifest --formats=bztar
50
51 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sha256: $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2
52         cd $(TOPDIR)/dist && \
53                 sha256sum ${package}-$(VERSION).tar.bz2 \
54                         > ${package}-$(VERSION).tar.bz2.sha256
55
56 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.sign: $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2
57         cd $(TOPDIR)/dist && \
58                 gpg --detach-sign -a --output \
59                         ${package}-$(VERSION).tar.bz2.asc \
60                         ${package}-$(VERSION).tar.bz2
61         cd $(TOPDIR)/dist && \
62                 chmod 644 $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.asc
63         cd $(TOPDIR)/dist && \
64                 gpg --verify $(TOPDIR)/dist/${package}-$(VERSION).tar.bz2.asc
65
66 clean:
67         PYTHONPATH=. python ./setup.py clean
68         rm -fr tmp/ dist/ build/ htmlcov/
69         @which $(COVERAGE2) > /dev/null 2>&1 && $(COVERAGE2) erase
70
71 distclean:      clean
72         find $(TOPDIR) -name "*.pyc" -exec rm -f {} \;
73         rm -f MANIFEST
74