forked from linuxmint/mintupdate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_desktop_files
executable file
·54 lines (44 loc) · 1.83 KB
/
generate_desktop_files
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
#!/usr/bin/python3
DOMAIN = "mintupdate"
PATH = "/usr/share/linuxmint/locale"
import os, gettext, sys
sys.path.append('/usr/lib/linuxmint/common')
import additionalfiles
import subprocess
os.environ['LANG'] = "en_US.UTF-8"
gettext.install(DOMAIN, PATH)
prefix = "[Desktop Entry]\n"
suffix = """Exec=mintupdate
Icon=mintupdate
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Application;System;Settings;XFCE;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
StartupNotify=false
NotShowIn=KDE;
"""
additionalfiles.generate(DOMAIN, PATH, "usr/share/applications/mintupdate.desktop", prefix, _("Update Manager"), _("Show and install available updates"), suffix)
suffix = """Exec=mintupdate
Icon=mintupdate
Terminal=false
Type=Application
Encoding=UTF-8
Categories=System;
StartupNotify=false
OnlyShowIn=KDE;
"""
additionalfiles.generate(DOMAIN, PATH, "usr/share/applications/mintupdate-kde.desktop", prefix, _("Update Manager"), _("Show and install available updates"), suffix, genericName=_("Show and install available updates"))
locales = []
cur_dir = os.getcwd()
os.chdir("/usr/share/linuxmint/locale")
lines = subprocess.getoutput("find */LC_MESSAGES/mintupdate.mo")
for line in lines.split("\n"):
line = line.strip().split("/")[0]
locales.append(line)
os.chdir(cur_dir)
for locale in locales:
os.system("mkdir -p usr/share/help/%s/mintupdate/" % locale)
os.system("msgunfmt /usr/share/linuxmint/locale/%s/LC_MESSAGES/mintupdate.mo > /tmp/%s.po" % (locale, locale))
os.system("xml2po -p /tmp/%s.po -o usr/share/help/%s/mintupdate/index.page usr/share/help/C/mintupdate/index.page" % (locale, locale))
os.system("xml2po -p /tmp/%s.po -o usr/share/help/%s/mintupdate/policy.page usr/share/help/C/mintupdate/policy.page" % (locale, locale))
os.system("cp usr/share/help/C/mintupdate/legal.xml usr/share/help/%s/mintupdate/" % locale)