forked from linuxmint/mintupdate
-
Notifications
You must be signed in to change notification settings - Fork 5
/
generate_desktop_files
executable file
·57 lines (46 loc) · 1.9 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
55
56
57
#!/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['LANGUAGE'] = "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;
"""
name = _("Update Manager")
comment = _("Show and install available updates")
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))
for page in ["index", "kernels", "levels", "mintupdate-tool", "policy", "regressions", "updates"]:
os.system("xml2po -p /tmp/%(locale)s.po -o usr/share/help/%(locale)s/mintupdate/%(page)s.page usr/share/help/C/mintupdate/%(page)s.page" % {'locale': locale, 'page':page})
os.system("cp usr/share/help/C/mintupdate/legal.xml usr/share/help/%s/mintupdate/" % locale)