-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
104 lines (84 loc) · 3 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# Makefile for pyparted
# Copyright The pyparted Project Authors
# SPDX-License-Identifier: GPL-2.0-or-later
#
PYTHON ?= python3
DESTDIR ?= /
PACKAGE = $(shell $(PYTHON) setup.py --name)
VERSION = $(shell $(PYTHON) setup.py --version)
TAG = v$(VERSION)
COVERAGE = coverage3
default: all
all:
@$(PYTHON) setup.py build
test: all
@env PYTHONPATH=$$(find $$(pwd) -name "*.so" | head -n 1 | xargs dirname):src/parted:src \
$(PYTHON) -m unittest discover -v
coverage: all
@echo "*** Running unittests with $(COVERAGE) for $(PYTHON) ***"
@env PYTHONPATH=$$(find $$(pwd) -name "*.so" | head -n 1 | xargs dirname):src/parted:src \
$(COVERAGE) run --branch -m unittest discover -v
$(COVERAGE) report --include="build/lib.*/parted/*" --show-missing
$(COVERAGE) report --include="build/lib.*/parted/*" > coverage-report.log
check: clean
$(MAKE) ; \
env PYTHONPATH=$$(find $$(pwd) -name "*.so" | head -n 1 | xargs dirname):src/parted:src \
tests/pylint/runpylint.py
dist:
@$(PYTHON) setup.py sdist
tag: dist
@if [ -z "$(GPGKEY)" ]; then \
echo "GPGKEY environment variable missing, please set this to the key ID" ; \
echo "you want to use to tag the repository." ; \
exit 1 ; \
fi
@git tag -u $(GPGKEY) -m "Tag as $(TAG)" -f $(TAG)
@echo "Tagged as $(TAG) (GPG signed)"
release: tag
( cd dist ; gzip -dc $(PACKAGE)-$(VERSION).tar.gz | tar -xvf - )
( cd dist/$(PACKAGE)-$(VERSION) && $(PYTHON) setup.py build ) || exit 1
@echo
@echo "$(PACKAGE)-$(VERSION) can be pushed to the git repo:"
@echo " git push && git push --tags"
@echo
@echo "*** Remember to run 'make pypi' afterwards ***"
@echo
pypi:
@echo "************************************************************************"
@echo "* Username and password are for your pypi.org login. *"
@echo "* NOTE: You must be a listed maintainer for pyparted for this to work. *"
@echo "* See ~/.pypirc *"
@echo "************************************************************************"
@echo
twine upload \
dist/$(PACKAGE)-$(VERSION).tar.gz \
dist/$(PACKAGE)-$(VERSION).tar.gz.asc
rpmlog:
@prevtag="$$(git tag -l | grep -v "^start$$" | tail -n 2 | head -n 1)" ; \
git log --pretty="format:- %s (%ae)" $${prevtag}.. | \
sed -e 's/@.*)/)/' | \
sed -e 's/%/%%/g' | \
grep -v "New version" | \
fold -s -w 77 | \
while read line ; do \
if [ ! "$$(echo $$line | cut -c-2)" = "- " ]; then \
echo " $$line" ; \
else \
echo "$$line" ; \
fi ; \
done
bumpver:
@OLDSUBVER=$$(echo $(VERSION) | rev | cut -d '.' -f 1 | rev) ; \
NEWSUBVER=$$(($${OLDSUBVER} + 1)) ; \
BASEVER="$$(echo $(VERSION) | sed -e "s|\.$${OLDSUBVER}$$||g")" ; \
NEWVERSION="$${BASEVER}.$${NEWSUBVER}" ; \
sed -i "s/pyparted_version = '$(VERSION)'/pyparted_version = '$${NEWVERSION}'/" setup.py ; \
echo "New version is $${NEWVERSION}"
install: all
@$(PYTHON) setup.py install --root $(DESTDIR) -c -O1
clean:
-rm -r build
ci: check coverage
verrel:
@echo $(PACKAGE)-$(VERSION)