forked from dasbus-project/dasbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (69 loc) · 2.7 KB
/
Makefile
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
# Copyright (C) 2019 Red Hat, Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
#
PKGNAME=dasbus
VERSION=$(shell awk '/Version:/ { print $$2 }' python-$(PKGNAME).spec)
TAG=v$(VERSION)
PYTHON?=python3
COVERAGE?=coverage3
# Arguments used for setup.py call for creating archive
BUILD_ARGS ?= sdist bdist_wheel
.PHONY: clean
clean:
git clean -fdx
.PHONY: check
check:
@echo "*** Running pylint ***"
$(PYTHON) -m pylint dasbus/ tests/
.PHONY: coverage
coverage:
@echo "*** Running unittests with $(COVERAGE) ***"
PYTHONPATH=. $(COVERAGE) run --branch -m unittest discover -v -s tests/
$(COVERAGE) report -m --include="dasbus/*" | tee coverage-report.log
.PHONY: docs
docs:
$(MAKE) -C docs html text
.PHONY: changelog
changelog:
@git log --no-merges --pretty="format:- %s (%ae)" $(TAG).. | sed -e 's/@.*)/)/'
.PHONY: commit
commit:
@NEWSUBVER=$$((`echo $(VERSION) | cut -d . -f 2` + 1)) ; \
NEWVERSION=`echo $(VERSION).$$NEWSUBVER | cut -d . -f 1,3` ; \
DATELINE="* `LC_ALL=C.UTF-8 date "+%a %b %d %Y"` `git config user.name` <`git config user.email`> - $$NEWVERSION-1" ; \
cl=`grep -n %changelog python-${PKGNAME}.spec | cut -d : -f 1` ; \
tail --lines=+$$(($$cl + 1)) python-${PKGNAME}.spec > speclog ; \
(head -n $$cl python-${PKGNAME}.spec ; echo "$$DATELINE" ; make --quiet changelog 2>/dev/null ; echo ""; cat speclog) > python-${PKGNAME}.spec.new ; \
mv python-${PKGNAME}.spec.new python-${PKGNAME}.spec ; rm -f speclog ; \
sed -i "s/Version:\( *\)$(VERSION)/Version:\1$$NEWVERSION/" python-${PKGNAME}.spec ; \
sed -i "s/version=\"$(VERSION)\"/version=\"$$NEWVERSION\"/" setup.py ; \
git add python-${PKGNAME}.spec setup.py ; \
git commit -m "New release: $$NEWVERSION"
.PHONY: tag
tag:
git tag -a -m "Tag as $(VERSION)" -f $(TAG)
@echo "Tagged as $(TAG)"
.PHONY: push
push:
@echo "Run the command 'git push --follow-tags' with '--dry-run' first."
.PHONY: archive
archive:
$(PYTHON) setup.py ${BUILD_ARGS}
@echo "The archive is in dist/$(PKGNAME)-$(VERSION).tar.gz"
.PHONY: upload
upload:
$(PYTHON) -m twine upload dist/*