-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
109 lines (98 loc) · 3.41 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
# -*- coding: utf-8-unix -*-
DESTDIR =
PREFIX = /usr/local
BINDIR = $(DESTDIR)$(PREFIX)/bin
DATADIR = $(DESTDIR)$(PREFIX)/share
LOCALEDIR = $(DESTDIR)$(PREFIX)/share/locale
# Paths to patch in files,
# referring to installed, final paths.
BINDIR_FINAL = $(PREFIX)/bin
DATADIR_FINAL = $(PREFIX)/share
LOCALEDIR_FINAL = $(PREFIX)/share/locale
# EDITOR must wait!
EDITOR = nano
build:
@echo "BUILDING PYTHON PACKAGE..."
mkdir -p build/nfoview
cp nfoview/*.py build/nfoview
sed -i "s|^DATA_DIR = .*$$|DATA_DIR = Path('$(DATADIR_FINAL)/nfoview')|" build/nfoview/paths.py
sed -i "s|^LOCALE_DIR = .*$$|LOCALE_DIR = Path('$(LOCALEDIR_FINAL)')|" build/nfoview/paths.py
fgrep -q "$(DATADIR_FINAL)/nfoview" build/nfoview/paths.py
fgrep -q "$(LOCALEDIR_FINAL)" build/nfoview/paths.py
@echo "BUILDING SCRIPT..."
mkdir -p build/bin
cp bin/nfoview.in build/bin/nfoview
sed -i "s|%LIBDIR%|$(DATADIR_FINAL)/nfoview|" build/bin/nfoview
fgrep -q "$(DATADIR_FINAL)/nfoview" build/bin/nfoview
chmod +x build/bin/nfoview
@echo "BUILDING TRANSLATIONS..."
mkdir -p build/mo
for LANG in `cat po/LINGUAS`; do msgfmt po/$$LANG.po -o build/mo/$$LANG.mo; done
@echo "BUILDING DESKTOP FILE..."
msgfmt --desktop -d po \
--template data/io.otsaloma.nfoview.desktop.in \
-o build/io.otsaloma.nfoview.desktop
@echo "BUILDING APPDATA FILE..."
msgfmt --xml -d po \
--template data/io.otsaloma.nfoview.appdata.xml.in \
-o build/io.otsaloma.nfoview.appdata.xml
touch build/.complete
check:
flake8 .
flake8 bin/*
clean:
rm -rf build
rm -rf nfoview.egg-info
rm -rf dist
rm -rf __pycache__
rm -rf */__pycache__
rm -rf */*/__pycache__
rm -rf */*/*/__pycache__
install:
test -f build/.complete
@echo "INSTALLING PYTHON PACKAGE..."
mkdir -p $(DATADIR)/nfoview/nfoview
cp -f build/nfoview/*.py $(DATADIR)/nfoview/nfoview
@echo "INSTALLING SCRIPT..."
mkdir -p $(BINDIR)
cp -f build/bin/nfoview $(BINDIR)
@echo "INSTALLING DATA FILES..."
mkdir -p $(DATADIR)/nfoview
cp -f data/*.ui $(DATADIR)/nfoview
@echo "INSTALLING ICONS..."
mkdir -p $(DATADIR)/icons/hicolor/scalable/apps
mkdir -p $(DATADIR)/icons/hicolor/symbolic/apps
cp -f data/io.otsaloma.nfoview.svg $(DATADIR)/icons/hicolor/scalable/apps
cp -f data/io.otsaloma.nfoview-symbolic.svg $(DATADIR)/icons/hicolor/symbolic/apps
@echo "INSTALLING TRANSLATIONS..."
for LANG in `cat po/LINGUAS`; do mkdir -p $(LOCALEDIR)/$$LANG/LC_MESSAGES; done
for LANG in `cat po/LINGUAS`; do cp -f build/mo/$$LANG.mo $(LOCALEDIR)/$$LANG/LC_MESSAGES/nfoview.mo; done
@echo "INSTALLING DESKTOP FILE..."
mkdir -p $(DATADIR)/applications
cp -f build/io.otsaloma.nfoview.desktop $(DATADIR)/applications
@echo "INSTALLING APPDATA FILE..."
mkdir -p $(DATADIR)/metainfo
cp -f build/io.otsaloma.nfoview.appdata.xml $(DATADIR)/metainfo
@echo "INSTALLING MAN PAGE..."
mkdir -p $(DATADIR)/man/man1
cp -f data/nfoview.1 $(DATADIR)/man/man1
# Interactive!
release:
$(MAKE) check test clean
@echo "BUMP VERSION NUMBERS"
$(EDITOR) nfoview/__init__.py
@echo "ADD RELEASE NOTES"
$(EDITOR) NEWS.md
$(EDITOR) data/io.otsaloma.nfoview.appdata.xml.in
appstream-util validate-relax --nonet data/io.otsaloma.nfoview.appdata.xml.in
sudo $(MAKE) PREFIX=/usr/local build install clean
/usr/local/bin/nfoview
tools/release
@echo "REMEMBER TO UPDATE FLATPAK"
@echo "REMEMBER TO UPDATE WEBSITE"
test:
py.test -xs .
# Interactive!
translations:
tools/update-translations
.PHONY: build check clean install release test translations