forked from projecthamster/hamster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
109 lines (76 loc) · 3.48 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- python -*-
from subprocess import getstatusoutput
from waflib import Utils
# slight code duplication with hamster/__init__.py, but this is finally cleaner.
rc, output = getstatusoutput("git describe --tags --always --dirty=+")
VERSION = "3.0.1" if rc else output
APPNAME = 'hamster'
top = '.'
out = 'build'
def options(ctx):
ctx.load('gnu_dirs')
# the waf default value is /usr/local, which causes issues (e.g. #309)
# ctx.parser.set_defaults(prefix='/usr') did not update the help string,
# hence need to replace the whole option
ctx.parser.remove_option('--prefix')
default_prefix = '/usr'
ctx.add_option('--prefix', dest='prefix', default=default_prefix,
help='installation prefix [default: {}]'.format(default_prefix))
ctx.add_option('--skip-gsettings', dest='skip_gsettings', action='store_true',
help='skip gsettings schemas build and installation (for packagers)')
ctx.add_option('--skip-icon-cache-update', dest='skip_icon_cache_update', action='store_true',
help='skip icon cache update (for packagers)')
def configure(ctx):
ctx.load('gnu_dirs') # for DATADIR
if not ctx.options.skip_gsettings:
ctx.load('glib2') # for GSettings support
ctx.load('python')
ctx.check_python_version(minver=(3,4,0))
ctx.load('intltool')
ctx.env.ENABLE_NLS = 1
ctx.env.HAVE_BIND_TEXTDOMAIN_CODESET = 1
ctx.env.VERSION = VERSION
ctx.env.GETTEXT_PACKAGE = "hamster"
ctx.env.PACKAGE = "hamster"
ctx.recurse("help")
# options are tied to a specific ./waf invocation (one terminal line),
# and woud have to be given again at any other ./waf invocation
# that is trouble when one wants to ./waf uninstall much later;
# it can be hard to remember the exact options used at the install step.
# So from now on, options have to be given at the configure step only.
# copy the options to the persistent env:
for name in ('prefix', 'skip_gsettings', 'skip_icon_cache_update'):
value = getattr(ctx.options, name)
setattr(ctx.env, name, value)
def build(ctx):
ctx.install_as('${LIBEXECDIR}/hamster/hamster-service', "src/hamster-service.py", chmod=Utils.O755)
ctx.install_as('${LIBEXECDIR}/hamster/hamster-windows-service', "src/hamster-windows-service.py", chmod=Utils.O755)
ctx.install_as('${BINDIR}/hamster', "src/hamster-cli.py", chmod=Utils.O755)
ctx.install_files('${PREFIX}/share/bash-completion/completions',
'src/hamster.bash')
ctx(features='py',
source=ctx.path.ant_glob('src/hamster/**/*.py'),
install_from='src')
# set correct flags in defs.py
ctx(features="subst",
source="src/hamster/defs.py.in",
target="src/hamster/defs.py",
install_path="${PYTHONDIR}/hamster"
)
ctx(features="subst",
source= "org.gnome.Hamster.service.in",
target= "org.gnome.Hamster.service",
install_path="${DATADIR}/dbus-1/services",
)
ctx(features="subst",
source= "org.gnome.Hamster.GUI.service.in",
target= "org.gnome.Hamster.GUI.service",
install_path="${DATADIR}/dbus-1/services",
)
ctx(features="subst",
source= "org.gnome.Hamster.WindowServer.service.in",
target= "org.gnome.Hamster.WindowServer.service",
install_path="${DATADIR}/dbus-1/services",
)
# look for wscript into further directories
ctx.recurse("po data help")