forked from gtimelog/gtimelog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
126 lines (106 loc) · 3.39 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
# Options
#
PYTHON = python
FILE_WITH_VERSION = src/gtimelog/__init__.py
FILE_WITH_CHANGELOG = NEWS.rst
#
# Interesting targets
#
manpages = gtimelog.1 gtimelogrc.5
po_files = $(wildcard po/*.po)
mo_files = $(patsubst po/%.po,locale/%/LC_MESSAGES/gtimelog.mo,$(po_files))
fallback_ui_files = src/gtimelog/gtimelog-gtk3.10.ui src/gtimelog/preferences-gtk3.10.ui
runtime_files = gschemas.compiled $(mo_files) $(fallback_ui_files)
.PHONY: all
all: $(manpages) $(runtime_files)
.PHONY: run
run: $(runtime_files)
./gtimelog
.PHONY: check test
check test:
./runtests
.PHONY: coverage
coverage:
detox -e coverage,coverage3 -- -p
coverage combine
coverage report
.PHONY: coverage-diff
coverage-diff: coverage
coverage xml
diff-cover coverage.xml
.PHONY: update-translations
update-translations:
cd po && intltool-update -g gtimelog -p
for po in $(po_files); do msgmerge -U $$po po/gtimelog.pot; done
%-gtk3.10.ui: %.ui
sed -e 's/margin_start/margin_left/' \
-e 's/margin_end/margin_right/' \
-e '/property name="monospace"/d' \
-e '/property name="max-width-chars"/d' \
-e '/GtkHeaderBar/,$$ s/<property name="position">.*<\/property>//' \
< $< > $@.tmp
mv $@.tmp $@
locale/%/LC_MESSAGES/gtimelog.mo: po/%.po
mkdir -p $(@D)
msgfmt -o $@ $<
gschemas.compiled: org.gtimelog.gschema.xml
glib-compile-schemas .
.PHONY: clean
clean:
rm -rf temp tmp build gtimelog.egg-info $(runtime_files) locale
find -name '*.pyc' -delete
.PHONY: dist
dist:
$(PYTHON) setup.py sdist
.PHONY: distcheck
distcheck: check dist
# Bit of a chicken-and-egg here, but if the tree is unclean, make
# distcheck will fail.
@test -z "`git status -s 2>&1`" || { echo; echo "Your working tree is not clean" 1>&2; git status; exit 1; }
make dist
pkg_and_version=`$(PYTHON) setup.py --name`-`$(PYTHON) setup.py --version` && \
rm -rf tmp && \
mkdir tmp && \
git archive --format=tar --prefix=tmp/tree/ HEAD | tar -xf - && \
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"
.PHONY: releasechecklist
releasechecklist:
@$(PYTHON) setup.py --version | grep -qv dev || { \
echo "Please remove the 'dev' suffix from the version number in $(FILE_WITH_VERSION)"; 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.rst || { \
echo "$(FILE_WITH_CHANGELOG) has no entry for $$ver_and_date"; 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 " rm -rf dist && $(PYTHON) setup.py sdist && twine upload dist/* && git tag `$(PYTHON) setup.py --version`"
@echo
@echo "Please increment the version number in $(FILE_WITH_VERSION)"
@echo "and add a new empty entry at the top of $(FILE_WITH_CHANGELOG), then"
@echo
@echo ' git commit -a -m "Post-release version bump" && git push && git push --tags'
@echo
%.1: %.rst
rst2man $< > $@
%.5: %.rst
rst2man $< > $@