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

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

def build(bld):
    
    if 'gtksourceview' in bld.env['MODULES_TO_BUILD']:
        bld.codegen('gtksourceview', local_register=['../gnomeprint/print.defs'])
        pyext = bld.create_pyext()
        pyext.source = 'gtksourceviewmodule.c gtksourceview.c'
        pyext.target = 'gtksourceview'
        pyext.uselib = 'GTKSOURCEVIEW'
        pyext.install_path = '${PYTHONDIR}/gtk-2.0'

        bld.install_files('${DATADIR}/pygtk/2.0/defs', 'gtksourceview.defs')

