Add tests for incorrect command usage detection
[pykickstart.git] / Makefile
blob414929edc518ce40d14261e9fa676751c6e8bd9b
1 PKGNAME=pykickstart
2 VERSION=$(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
3 RELEASE=$(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
4 TAG=r$(VERSION)-$(RELEASE)
6 TX_PULL_ARGS = -a --disable-overwrite
7 TX_PUSH_ARGS = -s
9 MANDIR=/usr/share/man
10 PREFIX=/usr
12 TESTSUITE:=tests/baseclass.py
14 all:
15 $(MAKE) -C po
17 po-pull:
18 tx pull $(TX_PULL_ARGS)
20 docs:
21 curl -A "pykickstart-build" -o docs/kickstart-docs.txt "https://fedoraproject.org/w/index.php?title=Anaconda/Kickstart&action=raw"
22 curl -A "programmers-guide" -o docs/programmers-guide "https://fedoraproject.org/w/index.php?title=PykickstartIntro&action=raw"
24 check:
25 @echo "*** Running pylint to verify source ***"
26 PYTHONPATH=. pylint pykickstart/*.py pykickstart/*/*.py --rcfile=/dev/null -i y -r n --disable=C,R --disable=W0141,W0142,W0221,W0401,W0403,W0404,W0603,W0611,W0612,W0613,W0614,W0703
28 test:
29 @echo "*** Running unittests ***"
30 PYTHONPATH=. python $(TESTSUITE) -v
32 coverage:
33 @which coverage || (echo "*** Please install python-coverage ***"; exit 2)
34 @echo "*** Running unittests with coverage ***"
35 PYTHONPATH=. coverage run $(TESTSUITE) -v
36 PYTHONPATH=. coverage report --show-missing --include='pykickstart/*'
38 clean:
39 -rm *.tar.gz pykickstart/*.pyc pykickstart/*/*.pyc tests/*.pyc tests/*/*.pyc docs/kickstart-docs.txt docs/programmers-guide ChangeLog
40 $(MAKE) -C po clean
41 python setup.py -q clean --all
43 install:
44 python setup.py install --root=$(DESTDIR)
45 $(MAKE) -C po install
47 ChangeLog:
48 (GIT_DIR=.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
50 tag:
51 git tag -a -m "Tag as $(TAG)" -f $(TAG)
52 @echo "Tagged as $(TAG)"
54 archive: check test tag docs
55 @rm -f ChangeLog
56 @make ChangeLog
57 git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
58 mkdir -p $(PKGNAME)-$(VERSION)
59 cp -r po $(PKGNAME)-$(VERSION)/po/
60 mkdir -p $(PKGNAME)-$(VERSION)/docs/
61 cp docs/kickstart-docs.txt $(PKGNAME)-$(VERSION)/docs/
62 cp docs/programmers-guide $(PKGNAME)-$(VERSION)/docs/
63 cp ChangeLog $(PKGNAME)-$(VERSION)/
64 tar -rf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
65 gzip -9 $(PKGNAME)-$(VERSION).tar
66 rm -rf $(PKGNAME)-$(VERSION)
67 git checkout -- po/$(PKGNAME).pot
68 @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
70 local: docs po-pull
71 @rm -f ChangeLog
72 @make ChangeLog
73 @rm -rf $(PKGNAME)-$(VERSION).tar.gz
74 @rm -rf /tmp/$(PKGNAME)-$(VERSION) /tmp/$(PKGNAME)
75 @dir=$$PWD; cp -a $$dir /tmp/$(PKGNAME)-$(VERSION)
76 @cd /tmp/$(PKGNAME)-$(VERSION) ; python setup.py -q sdist
77 @cp /tmp/$(PKGNAME)-$(VERSION)/dist/$(PKGNAME)-$(VERSION).tar.gz .
78 @rm -rf /tmp/$(PKGNAME)-$(VERSION)
79 @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
81 rpmlog:
82 @git log --pretty="format:- %s (%ae)" $(TAG).. |sed -e 's/@.*)/)/'
83 @echo
85 bumpver: po-pull
86 @NEWSUBVER=$$((`echo $(VERSION) |cut -d . -f 3` + 1)) ; \
87 NEWVERSION=`echo $(VERSION).$$NEWSUBVER |cut -d . -f 1,2,4` ; \
88 DATELINE="* `date "+%a %b %d %Y"` `git config user.name` <`git config user.email`> - $$NEWVERSION-1" ; \
89 cl=`grep -n %changelog pykickstart.spec |cut -d : -f 1` ; \
90 tail --lines=+$$(($$cl + 1)) pykickstart.spec > speclog ; \
91 (head -n $$cl pykickstart.spec ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > pykickstart.spec.new ; \
92 mv pykickstart.spec.new pykickstart.spec ; rm -f speclog ; \
93 sed -i "s/Version: $(VERSION)/Version: $$NEWVERSION/" pykickstart.spec ; \
94 sed -i "s/version='$(VERSION)'/version='$$NEWVERSION'/" setup.py ; \
95 make -C po $(PKGNAME).pot ; \
96 tx push $(TX_PUSH_ARGS)
98 .PHONY: check clean install tag archive local docs