summaryrefslogtreecommitdiffstats
path: root/util/gconf/wscript
blob: 442c6297a43d14b64e83ad48a424453231af8584 (plain)
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
# -*- python -*-
# encoding: utf-8

import os
import Common

def configure(conf):
    conf.env.append_value('MODULES_AVAILABLE', 'gconf')
    if 'gconf' in conf.env['ENABLE_MODULES'] or 'all' in conf.env['ENABLE_MODULES']:
        if conf.check_pkg('gconf-2.0 >= 2.12 pygobject-2.0',
                          destvar='GCONF', mandatory=False):
            conf.env.append_value('MODULES_TO_BUILD', 'gconf')


def codegen(bld, module):
    cmd = bld.create_obj('command-output')
    cmd.command = 'pygtk-codegen-2.0'
    cmd.command_is_external = True
    cmd.prio = 5
    cmd.argv = [
        '--py_ssize_t-clean',
        '--load-types', cmd.input_file('gconf-arg-types.py'),
        '--prefix', 'py'+module,
        '--override', cmd.input_file("%s.override" % module),
        cmd.input_file("%s.defs" % module),
        ]
    cmd.stdout = '%s.c' % module
    return cmd


def build(bld):
    
    if 'gconf' in bld.env()['MODULES_TO_BUILD']:
        codegen(bld, 'gconf')
        pyext = bld.create_pyext()
        pyext.source = 'gconfmodule.c gconf.c gconf-fixes.c gconf-types.c'
        pyext.target = 'gconf'
        pyext.uselib = 'GCONF'
        pyext.includes = '.'
        pyext.inst_var = 'PYTHONDIR'
        pyext.inst_dir = 'gtk-2.0'

        Common.install_files('DATADIR', os.path.join('pygtk', '2.0', 'defs'),
                             ['gconf.defs'])

        Common.install_files('DATADIR', os.path.join('pygtk', '2.0', 'argtypes'),
                             'gconf-arg-types.py')