# -*- python -*-
# encoding: utf-8

import os

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


def build(bld):
    
    if 'mateconf' in bld.env['MODULES_TO_BUILD']:
        bld.codegen('mateconf', local_load_types=['mateconf-arg-types.py'])
        pyext = bld.create_pyext()
        pyext.source = 'mateconfmodule.c mateconf.c mateconf-fixes.c mateconf-types.c'
        pyext.target = 'mateconf'
        pyext.uselib = 'MATECONF'
        pyext.includes = '.'
        pyext.install_path = '${PYTHONDIR}/gtk-2.0'

        bld.install_files('${DATADIR}/pygtk/2.0/defs',
                          ['mateconf.defs'])

        bld.install_files('${DATADIR}/pygtk/2.0/argtypes',
                          'mateconf-arg-types.py')
