-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (107 loc) · 4.46 KB
/
Makefile
File metadata and controls
132 lines (107 loc) · 4.46 KB
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
127
128
129
130
131
132
PKGNAME=python-meh
VERSION=$(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
RELEASE=$(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
TAG=$(PKGNAME)-$(VERSION)
PYTHON=python3
TESTSUITE:=tests/baseclass.py
PYCHECKEROPTS=--no-argsused --no-miximport --maxargs 0 --no-local -\# 0 --only -Q
# LOCALIZATION SETTINGS
L10N_REPOSITORY ?= https://github.com/rhinstaller/python-meh-l10n.git
L10N_REPOSITORY_RW ?= git@github.com:rhinstaller/python-meh-l10n.git
# Branch used in localization repository. This should be master all the time.
GIT_L10N_BRANCH ?= master
# Directory in localization repository specific for this branch.
L10N_DIR ?= master
default: all
all:
$(MAKE) -C po
clean:
-rm *.tar.gz meh/*.pyc meh/ui/*.pyc tests/*.pyc ChangeLog
$(MAKE) -C po clean
$(PYTHON) setup.py -q clean --all
test:
@echo "*** Running unittests with Python 3 ***"
PYTHONPATH=. $(PYTHON) $(TESTSUITE) -v
check:
PYTHONPATH=. tests/pylint/runpylint.py
install:
$(PYTHON) setup.py install --root=$(DESTDIR)
$(MAKE) -C po install
ChangeLog:
(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)
tag:
git tag -a -m "Tag as $(TAG)" -f $(TAG)
@echo "Tagged as $(TAG)"
release: tag archive
archive: po-pull
@rm -f ChangeLog
@make ChangeLog
git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
mkdir $(PKGNAME)-$(VERSION)
cp -r po $(PKGNAME)-$(VERSION)
cp ChangeLog $(PKGNAME)-$(VERSION)/
tar -rf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
gzip -9 $(PKGNAME)-$(VERSION).tar
rm -rf $(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
local: po-pull
@rm -f ChangeLog
@make ChangeLog
@rm -rf $(PKGNAME)-$(VERSION).tar.gz
@rm -rf /tmp/$(PKGNAME)-$(VERSION) /tmp/$(PKGNAME)
@dir=$$PWD; cp -a $$dir /tmp/$(PKGNAME)-$(VERSION)
@cd /tmp/$(PKGNAME)-$(VERSION) ; $(PYTHON) setup.py -q sdist
@cp /tmp/$(PKGNAME)-$(VERSION)/dist/$(PKGNAME)-$(VERSION).tar.gz .
@rm -rf /tmp/$(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
rpmlog:
@git log --pretty="format:- %s (%ae)" $(TAG).. |sed -e 's/@.*)/)/'
@echo
potfile:
$(MAKE) -C po potfile
po-pull:
TEMP_DIR=$$(mktemp --tmpdir -d $(PKGNAME)-localization-XXXXXXXXXX) && \
git clone --depth 1 -b $(GIT_L10N_BRANCH) -- $(L10N_REPOSITORY) $$TEMP_DIR && \
cp $$TEMP_DIR/$(L10N_DIR)/*.po ./po/ && \
rm -rf $$TEMP_DIR
po-push: potfile
# This algorithm will make these steps:
# - clone localization repository
# - copy pot file to this repository
# - check if pot file is changed (ignore the POT-Creation-Date otherwise it's always changed)
# - if not changed:
# - remove cloned repository
# - if changed:
# - add pot file
# - commit pot file
# - tell user to verify this file and push to the remote from the temp dir
TEMP_DIR=$$(mktemp --tmpdir -d $(PKGNAME)-localization-XXXXXXXXXX) || exit 1 ; \
git clone --depth 1 -b $(GIT_L10N_BRANCH) -- $(L10N_REPOSITORY_RW) $$TEMP_DIR || exit 2 ; \
cp ./po/$(PKGNAME).pot $$TEMP_DIR/$(L10N_DIR)/ || exit 3 ; \
pushd $$TEMP_DIR/$(L10N_DIR) ; \
git difftool --trust-exit-code -y -x "diff -u -I '^\"POT-Creation-Date: .*$$'" HEAD ./$(PKGNAME).pot &>/dev/null ; \
if [ $$? -eq 0 ] ; then \
popd ; \
echo "Pot file is up to date" ; \
rm -rf $$TEMP_DIR ; \
else \
git add ./$(PKGNAME).pot && \
git commit -m "Update $(PKGNAME).pot" && \
popd && \
echo "Pot file updated for the localization repository $(L10N_REPOSITORY)" && \
echo "Please confirm changes and push:" && \
echo "$$TEMP_DIR" ; \
fi ;
bumpver: po-push
read -p "Please see the above message. Verify and push localization commit. Press anything to continue." -n 1 -r
@NEWSUBVER=$$((`echo $(VERSION) |cut -d . -f 2` + 1)) ; \
NEWVERSION=`echo $(VERSION).$$NEWSUBVER |cut -d . -f 1,3` ; \
DATELINE="* `LANG=c date "+%a %b %d %Y"` `git config user.name` <`git config user.email`> - $$NEWVERSION-1" ; \
cl=`grep -n %changelog python-meh.spec |cut -d : -f 1` ; \
tail --lines=+$$(($$cl + 1)) python-meh.spec > speclog ; \
(head -n $$cl python-meh.spec ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > python-meh.spec.new ; \
mv python-meh.spec.new python-meh.spec ; rm -f speclog ; \
sed -i "s/Version: $(VERSION)/Version: $$NEWVERSION/" python-meh.spec ; \
sed -i "s/version='$(VERSION)'/version='$$NEWVERSION'/" setup.py
ci: check test
.PHONY: clean install tag archive local