Skip to content

Commit

Permalink
Automatically generate .desktop and AppData files (#826)
Browse files Browse the repository at this point in the history
* Build appdata.xml and desktop file from po
* Add make all_no_locale
* make test_compile copies everything necessary to do make all
  • Loading branch information
luzip665 committed Dec 20, 2022
1 parent a8d0a28 commit 6d244f0
Show file tree
Hide file tree
Showing 82 changed files with 4,348 additions and 1,347 deletions.
36 changes: 24 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ EXAILEMANDIR = $(DESTDIR)$(MANPREFIX)/man
plugins-dist manpage completion clean pot potball dist check-doc test \
test_coverage lint_errors sanitycheck format

all: compile completion locale manpage
all: compile completion locale manpage desktop_files
@echo "Ready to install..."

# The no_locale stuff is by request of BSD people, please ensure
# all methods that deal with locale stuff have a no_locale variant
all_no_locale: compile completion manpage
all_no_locale: compile completion manpage desktop_files_no_locale
@echo "Ready to install..."

builddir:
Expand Down Expand Up @@ -105,6 +105,11 @@ uninstall:
$(MAKE) -C plugins uninstall
find $(DESTDIR)$(DATADIR)/locale -name "exaile.mo" -exec rm -f {} \;

# List a *.mo file for any *.po file
LOCALE_SRCS=$(wildcard po/*.po)
LOCALE_OBJS=$(LOCALE_SRCS:.po=.mo)
LINGUAS=$(sort $(patsubst po/%.po,%,$(LOCALE_SRCS)))

install: install-target install-locale

install_no_locale: install-target
Expand Down Expand Up @@ -152,9 +157,9 @@ install-target: make-install-dirs
install -p -m 644 data/ui/preferences/*.ui $(EXAILESHAREDIR)/data/ui/preferences
install -p -m 644 data/ui/preferences/widgets/*.ui $(EXAILESHAREDIR)/data/ui/preferences/widgets
install -p -m 644 data/ui/widgets/*.ui $(EXAILESHAREDIR)/data/ui/widgets
install -p -m 644 data/exaile.desktop \
install -p -m 644 build/exaile.desktop \
$(DESTDIR)$(DATADIR)/applications/
install -p -m 644 data/exaile.appdata.xml \
install -p -m 644 build/exaile.appdata.xml \
$(DESTDIR)$(DATADIR)/metainfo/
-install -p -m 644 build/exaile.1.gz $(EXAILEMANDIR)/man1/
-install -p -m 644 build/exaile.bash-completion $(DESTDIR)$(BASHCOMPDIR)/exaile
Expand All @@ -172,17 +177,12 @@ install-target: make-install-dirs
fi
$(MAKE) -C plugins install


# List a *.mo file for any *.po file
LOCALE_SRCS=$(wildcard po/*.po)
LOCALE_OBJS=$(LOCALE_SRCS:.po=.mo)

%.mo: %.po po/messages.pot
$(eval LOCALE_DIR := `echo $< | sed "s|^po/|build/locale/|" | sed "s|.po|/LC_MESSAGES|"`)
mkdir -p $(LOCALE_DIR)
-msgmerge -q -o - $< po/messages.pot | msgfmt -c -o $(LOCALE_DIR)/exaile.mo -

locale: builddir $(LOCALE_OBJS)
locale: builddir $(LOCALE_OBJS) desktop_files

install-locale:
for f in `find build/locale -name exaile.mo` ; do \
Expand Down Expand Up @@ -213,6 +213,7 @@ clean:
-$(MAKE) -C doc clean
# for older versions of this Makefile:
find po/* -depth -type d -exec rm -r {} \;
if [ -f po/LINGUAS ]; then rm po/LINGUAS; fi

po/messages.pot: pot

Expand All @@ -228,9 +229,12 @@ pot:
find ../plugins -name "*.ui" | sort ; } \
| xgettext --files-from=- --output=messages.pot --from-code=UTF-8 --add-comments=TRANSLATORS --keyword=N_ && \
find ../plugins -name PLUGININFO | sort \
| xgettext --files-from=- --output=messages.pot --from-code=UTF-8 --add-comments=TRANSLATORS --join-existing --language=Python )
| xgettext --files-from=- --output=messages.pot --from-code=UTF-8 --add-comments=TRANSLATORS --join-existing --language=Python && \
xgettext -j -o messages.pot --keyword=X-GNOME-FullName '../data/exaile.desktop.in' && \
xgettext -j -o messages.pot '../data/exaile.appdata.xml.in' )
find po -name '*.po' -exec \
msgmerge --previous --update {} po/messages.pot \;
echo $(LINGUAS) > po/LINGUAS

potball: builddir
tar --bzip2 --format=posix -cf build/exaile-po.tar.bz2 po/ \
Expand All @@ -249,7 +253,7 @@ check-doc: clean
BUILD_DIR = /tmp/exaile-test-build
test_compile:
mkdir -p $(BUILD_DIR)
cp --recursive xl xlgui plugins tools Makefile $(BUILD_DIR)
cp --recursive xl xlgui plugins tools po data Makefile exaile exaile.py $(BUILD_DIR)
$(MAKE) -C $(BUILD_DIR) all

test:
Expand All @@ -272,3 +276,11 @@ format:

check_format:
$(BLACK) --check --diff -S *.py plugins/ xl/ xlgui/ tests/

desktop_files: builddir
msgfmt --desktop --template=data/exaile.desktop.in -d po -o build/exaile.desktop
msgfmt --xml --template=data/exaile.appdata.xml.in -d po -o build/exaile.appdata.xml

desktop_files_no_locale: builddir
cp data/exaile.desktop.in build/exaile.desktop
cp data/exaile.appdata.xml.in build/exaile.appdata.xml
11 changes: 10 additions & 1 deletion data/exaile.appdata.xml → data/exaile.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<component>
<component type="desktop-application">
<id type="desktop">exaile.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
Expand All @@ -26,4 +26,13 @@
</screenshots>
<url type="homepage">https://www.exaile.org</url>
<updatecontact>exaile-devel@googlegroups.com</updatecontact>
<provides>
<binary>exaile</binary>
<dbus type="user">org.exaile.Exaile</dbus>
</provides>
<launchable type="desktop-id">exaile.desktop</launchable>
<update_contact>exaile-devel@googlegroups.com</update_contact>
<url type="bugtracker">https://github.com/exaile/exaile/issues</url>
<url type="translate">https://hosted.weblate.org/projects/exaile</url>
<translation type="gettext">exaile</translation>
</component>
45 changes: 0 additions & 45 deletions data/exaile.desktop

This file was deleted.

15 changes: 15 additions & 0 deletions data/exaile.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Exaile
GenericName=Music Player
X-GNOME-FullName=Exaile Music Player
Comment=Listen to, explore, or manage your audio collection
Icon=exaile
Exec=exaile --quiet %F
Terminal=false
StartupWMClass=exaile.py
MimeType=audio/musepack;application/musepack;application/x-ape;audio/ape;audio/x-ape;audio/x-musepack;application/x-musepack;audio/x-mp3;application/x-id3;audio/mpeg;audio/x-mpeg;audio/x-mpeg-3;audio/mpeg3;audio/mp3;audio/x-m4a;audio/mpc;audio/x-mpc;audio/mp;audio/x-mp;application/ogg;application/x-ogg;audio/vorbis;audio/x-vorbis;audio/ogg;audio/x-ogg;audio/x-flac;application/x-flac;audio/flac;
Keywords=Music;Player;Library;Collection;MP3;
Categories=AudioVideo;Audio;Player;GTK;
Keywords=player,mp3,ogg
67 changes: 54 additions & 13 deletions po/af.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: exaile\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-03 00:51+0100\n"
"POT-Creation-Date: 2022-10-06 12:28+0200\n"
"PO-Revision-Date: 2020-11-15 08:28+0000\n"
"Last-Translator: Pera Petrovic <srdjan.todorovic.872019@gmail.com>\n"
"Language-Team: Afrikaans <https://hosted.weblate.org/projects/exaile/master/"
Expand Down Expand Up @@ -1635,7 +1635,7 @@ msgstr "Pas die huidige waarde op alle snitte toe"
msgid "Saved %(count)s of %(total)s."
msgstr "%(count)s van %(total)s gestoor."

#: ../xlgui/tray.py:203
#: ../xlgui/tray.py:203 ../data/exaile.desktop.in:7
msgid "Exaile Music Player"
msgstr "Exaile Musiekspeler"

Expand Down Expand Up @@ -1770,15 +1770,15 @@ msgstr "Speel nie tans nie"
msgid "%d in collection"
msgstr "%d in versameling"

#: ../xlgui/widgets/info.py:448 ../xlgui/widgets/info.py:453
#: ../xlgui/widgets/info.py:448 ../xlgui/widgets/info.py:457
#, fuzzy, python-format
#| msgid "%d showing"
msgid "%d showing"
msgid_plural "%d showing"
msgstr[0] "%d vertoon"
msgstr[1] "%d vertoon"

#: ../xlgui/widgets/info.py:451 ../xlgui/widgets/info.py:455
#: ../xlgui/widgets/info.py:452 ../xlgui/widgets/info.py:462
#, fuzzy, python-format
#| msgid "%d selected"
msgid "%d selected"
Expand Down Expand Up @@ -1996,15 +1996,15 @@ msgstr "Gaan voort met terugspeel na hierdie snit"
msgid "_Remove from Playlist"
msgstr "Hernoem speellys"

#: ../xlgui/widgets/playlist.py:739
#: ../xlgui/widgets/playlist.py:759
msgid "Requires plugins providing dynamic playlists"
msgstr "Benodig uitbreidings vir dinamiese speellyste"

#: ../xlgui/widgets/playlist.py:743 ../data/ui/playlist.ui:99
#: ../xlgui/widgets/playlist.py:763 ../data/ui/playlist.ui:99
msgid "Dynamically add similar tracks to the playlist"
msgstr "Voeg soortgelyke snitte dinamies tot die speellys toe"

#: ../xlgui/widgets/playlist.py:799
#: ../xlgui/widgets/playlist.py:806
#, fuzzy
#| msgid "Loading..."
msgid "Loading"
Expand Down Expand Up @@ -2055,11 +2055,11 @@ msgstr "He_rskaalbaar"
msgid "_Autosize"
msgstr "_Outomaties skaleer"

#: ../xlgui/widgets/queue.py:81
#: ../xlgui/widgets/queue.py:79
msgid "Queue"
msgstr "Wagtou"

#: ../xlgui/widgets/queue.py:83
#: ../xlgui/widgets/queue.py:81
#, python-format
msgid "Queue (%d)"
msgstr "Wagtou (%d)"
Expand Down Expand Up @@ -2570,8 +2570,8 @@ msgstr "Vertoon openingsskerm aan die begin"
#: ../data/ui/preferences/appearance.ui:330
msgid ""
"Tray icons are not supported on some platforms, most notably on Wayland. On "
"GNOME Shell 3.26+ on Xorg, tray icons only work if you have the <a href="
"\"https://extensions.gnome.org/extension/495/topicons/\">\"TopIcons\" "
"GNOME Shell 3.26+ on Xorg, tray icons only work if you have the <a "
"href=\"https://extensions.gnome.org/extension/495/topicons/\">\"TopIcons\" "
"extension</a> (or a similar one) installed."
msgstr ""

Expand Down Expand Up @@ -4589,8 +4589,8 @@ msgstr "As die hoofvenster gefokus is"
msgid ""
"Every tag can be used with <b>$tag</b> or <b>${tag}</b>. Internal tags like "
"<b>$__length</b> need to be specified with two leading underscores.\n"
"<a href=\"https://developer.gnome.org/pango/stable/PangoMarkupFormat.html"
"\">Pango Text Attribute Markup</a> is supported."
"<a href=\"https://developer.gnome.org/pango/stable/PangoMarkupFormat."
"html\">Pango Text Attribute Markup</a> is supported."
msgstr ""

#: ../plugins/osd/osd_preferences.ui:87
Expand Down Expand Up @@ -5197,6 +5197,47 @@ msgid ""
"Requires: pyHook (%s) or keyboard (%s)"
msgstr ""

#: ../data/exaile.desktop.in:5 ../data/exaile.appdata.xml.in:6
#, fuzzy
#| msgid "About Exaile"
msgid "Exaile"
msgstr "Aangaande"

#: ../data/exaile.desktop.in:6
#, fuzzy
#| msgid "Exaile Music Player"
msgid "Music Player"
msgstr "Exaile Musiekspeler"

#: ../data/exaile.desktop.in:8 ../data/exaile.appdata.xml.in:7
msgid "Listen to, explore, or manage your audio collection"
msgstr ""

#: ../data/exaile.desktop.in:14
msgid "Music;Player;Library;Collection;MP3;"
msgstr ""

#: ../data/exaile.desktop.in:15
msgid "player,mp3,ogg"
msgstr ""

#: ../data/exaile.appdata.xml.in:9
msgid ""
"Exaile is a music player with a simple interface and powerful music "
"management capabilities. Features include automatic fetching of album art, "
"lyrics fetching, streaming internet radio, tabbed playlists, smart playlists "
"with extensive filtering/search capabilities, and much more."
msgstr ""

#: ../data/exaile.appdata.xml.in:15
msgid ""
"Exaile is written using python and GTK+ and is easily extensible via "
"plugins. There are over 50 plugins distributed with Exaile that include "
"advanced track tagging, last.fm scrobbling, support for portable media "
"players, podcasts, internet radio such as icecast and Soma.FM, ReplayGain, "
"output via a secondary output device (great for DJs!), and much more."
msgstr ""

#, fuzzy
#~| msgid "Only album:"
#~ msgid "by {album}"
Expand Down

0 comments on commit 6d244f0

Please sign in to comment.