Don't use parameter labels when calling __for_each_task_set_status().
[gpodder.git] / tools / create-desktop-icon.py
blob67b383b5b2e674d22e9d43fa1284569b852a7597
1 #!/usr/bin/env python3
2 # create-desktop-icon.py: Create a Desktop icon
3 # 2016-12-22 Thomas Perl <m@thp.io>
5 import os
6 import sys
8 from gi.repository import GLib
10 BASE = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
12 TEMPLATE = """# Created by %(__file__)s
13 [Desktop Entry]
14 Name=gPodder (Git)
15 Exec=%(BASE)s/bin/gpodder
16 Icon=%(BASE)s/share/icons/hicolor/scalable/apps/gpodder.svg
17 Terminal=false
18 Type=Application
19 """ % locals()
21 DESKTOP = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP)
23 if not os.path.exists(DESKTOP):
24 print("{} desktop folder doesn't exists, exiting".format(DESKTOP))
25 sys.exit(1)
27 DESTINATION = os.path.join(DESKTOP, 'gpodder-git.desktop')
29 if os.path.exists(DESTINATION):
30 print('{} already exists, not overwriting'.format(DESTINATION))
31 sys.exit(1)
33 with open(DESTINATION, 'w') as fp:
34 fp.write(TEMPLATE)
35 os.chmod(DESTINATION, 0o755)
37 print('Wrote {}'.format(DESTINATION))