-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
73 lines (53 loc) · 2.13 KB
/
wscript
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- python -*-
from subprocess import getstatusoutput
rc, output = getstatusoutput("git describe --tags --always --dirty=+")
VERSION = '0.1.0' if rc else output
APPNAME = 'hamster-lite'
top = '.'
out = 'build'
import os
from waflib import Logs, Utils
def configure(conf):
conf.load('gnu_dirs') # for DATADIR
conf.load('python')
conf.check_python_version(minver=(3,4,0))
conf.load('intltool')
conf.env.ENABLE_NLS = 1
conf.env.HAVE_BIND_TEXTDOMAIN_CODESET = 1
conf.env.VERSION = VERSION
conf.env.GETTEXT_PACKAGE = "hamster-lite"
conf.env.PACKAGE = "hamster-lite"
def options(opt):
# the waf default value is /usr/local, which causes issues (e.g. #309)
# opt.parser.set_defaults(prefix='/usr') did not update the help string,
# hence need to replace the whole option
opt.parser.remove_option('--prefix')
default_prefix = '/usr'
opt.add_option('--prefix', dest='prefix', default=default_prefix,
help='installation prefix [default: {}]'.format(default_prefix))
def build(bld):
bld.install_as('${BINDIR}/hamster-lite', "src/hamster-lite", chmod=Utils.O755)
bld.install_files('${PREFIX}/share/bash-completion/completion',
'src/hamster-lite.bash')
bld(features='py',
source=bld.path.ant_glob('src/**/*.py'),
install_from='src')
# set correct flags in defs.py
bld(features="subst",
source="src/hamster_lite/defs.py.in",
target="src/hamster_lite/defs.py",
install_path="${PYTHONDIR}/hamster_lite"
)
bld.recurse("po data")
def update_icon_cache(ctx):
"""Update the gtk icon cache."""
if ctx.cmd == "install":
# adapted from the previous waf gnome.py
icon_dir = os.path.join(ctx.env.DATADIR, 'icons/hicolor')
cmd = 'gtk-update-icon-cache -q -f -t {}'.format(icon_dir)
err = ctx.exec_command(cmd)
if err:
Logs.warn('The following command failed:\n{}'.format(cmd))
else:
Logs.pprint('YELLOW', 'Successfully updated GTK icon cache')
bld.add_post_fun(update_icon_cache)