Debian Codegraph @

data/wscript

raw
1 # This file is meant to be included in the root wscript,
2 # through the recurse("data") command.
3 # An advantage of keeping it there
4 # instead of blending it in the root wscript build()
5 # is that the files are looked for in the same folder
6 # (no need to prepend data/ everywhere)
7
8 import os
9
10 from waflib import Logs
11
12
13 def build(ctx):
14 if not ctx.env.skip_gsettings:
15 ctx(features='glib2',
16 settings_schema_files=['org.gnome.hamster.gschema.xml'])
17
18 filename = "org.gnome.Hamster.metainfo.xml"
19 ctx(features = "subst",
20 source= "%s.in" % filename,
21 target= "%s" % filename,
22 dict = ctx.env,
23 install_path = "${DATADIR}/metainfo"
24 )
25
26 filename = "org.gnome.Hamster.GUI.desktop"
27 ctx(features = "subst",
28 source= "%s.in" % filename,
29 target= "%s" % filename,
30 dict = ctx.env,
31 install_path = "${DATADIR}/applications"
32 )
33
34 start_dir = ctx.path.find_dir('.')
35
36 # glade builder files
37 ctx.install_files('${DATADIR}/hamster', start_dir.ant_glob('*.ui'))
38 # default files
39 ctx.install_files('${DATADIR}/hamster', 'hamster.db')
40 ctx.install_files('${DATADIR}/hamster', 'report_template.html')
41
42 # icons
43 ctx.install_files('${DATADIR}/hamster/art', start_dir.ant_glob('art/*.png'))
44 ctx.install_files('${DATADIR}/icons/hicolor/16x16/apps', 'art/16x16/org.gnome.Hamster.GUI.png')
45 ctx.install_files('${DATADIR}/icons/hicolor/22x22/apps', 'art/22x22/org.gnome.Hamster.GUI.png')
46 ctx.install_files('${DATADIR}/icons/hicolor/24x24/apps', 'art/24x24/org.gnome.Hamster.GUI.png')
47 ctx.install_files('${DATADIR}/icons/hicolor/32x32/apps', 'art/32x32/org.gnome.Hamster.GUI.png')
48 ctx.install_files('${DATADIR}/icons/hicolor/48x48/apps', 'art/scalable/org.gnome.Hamster.GUI.png')
49 ctx.install_files('${DATADIR}/icons/hicolor/scalable/apps','art/scalable/org.gnome.Hamster.GUI.svg')
50
51 if not ctx.env.skip_icon_cache_update:
52 ctx.add_post_fun(update_icon_cache)
53
54
55 # icon cache update
56 def update_icon_cache(ctx):
57 """Update the gtk icon cache."""
58 if ctx.cmd == "install":
59 # adapted from the previous waf gnome.py
60 icon_dir = os.path.join(ctx.env.DATADIR, 'icons/hicolor')
61 cmd = 'gtk-update-icon-cache -q -f -t {}'.format(icon_dir)
62 err = ctx.exec_command(cmd)
63 if err:
64 Logs.warn('The following command failed:\n{}'.format(cmd))
65 else:
66 Logs.pprint('YELLOW', 'Successfully updated GTK icon cache')