vala

At this point, vala is still unstable, so do not expect this tool to be too stable either (apis, etc)

waflib.Tools.vala.extension(*k)

Decorator that registers a task generator method which will be invoked during the processing of source files for the extension given:

from waflib import Task
class mytask(Task):
        run_str = 'cp ${SRC} ${TGT}'
@extension('.moo')
def create_maa_file(self, node):
        self.create_task('mytask', node, node.change_ext('.maa'))
def build(bld):
        bld(source='foo.moo')
waflib.Tools.vala.taskgen_method(func)

Decorator that registers method as a task generator method. The function must accept a task generator as first parameter:

from waflib.TaskGen import taskgen_method
@taskgen_method
def mymethod(self):
        pass
Parameters

func (function) – task generator method to add

Return type

function

waflib.Tools.vala.conf(f)

Decorator: attach new configuration functions to waflib.Build.BuildContext and waflib.Configure.ConfigurationContext. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:

def configure(conf):
        conf.find_program('abc', mandatory=False)
Parameters

f (function) – method to bind

class waflib.Tools.vala.valac(*k, **kw)[source]

Compiles vala files

vars = ['VALAC', 'VALAC_VERSION', 'VALAFLAGS']

ConfigSet variables that should trigger a rebuild (class attribute used for waflib.Task.Task.sig_vars())

ext_out = ['.h']

File extensions that objects of this task class may create

hasrun
generator
env

waflib.ConfigSet.ConfigSet object (make sure to provide one)

inputs

List of input nodes, which represent the files used by the task instance

outputs

List of output nodes, which represent the files created by the task instance

dep_nodes

List of additional nodes to depend on

run_after

Set of tasks that must be executed before this one

hcode = b"\tdef run(self):\n\t\tcmd = self.env.VALAC + self.env.VALAFLAGS\n\t\tresources = getattr(self, 'vala_exclude', [])\n\t\tcmd.extend([a.abspath() for a in self.inputs if a not in resources])\n\t\tret = self.exec_command(cmd, cwd=self.vala_dir_node.abspath())\n\n\t\tif ret:\n\t\t\treturn ret\n\n\t\tif self.generator.dump_deps_node:\n\t\t\tself.generator.dump_deps_node.write('\\n'.join(self.generator.packages))\n\n\t\treturn ret\n"

String representing an additional hash for the class representation

waflib.Tools.vala.init_vala_task(self)[source]

Task generator method

Initializes the vala task with the relevant data (acts as a constructor)

waflib.Tools.vala.vala_file(self, node)[source]

Compile a vala file and bind the task to self.valatask. If an existing vala task is already set, add the node to its inputs. The typical example is:

def build(bld):
        bld.program(
                packages      = 'gtk+-2.0',
                target        = 'vala-gtk-example',
                use           = 'GTK GLIB',
                source        = 'vala-gtk-example.vala foo.vala',
                vala_defines  = ['DEBUG'] # adds --define=<xyz> values to the command-line

                # the following arguments are for libraries
                #gir          = 'hello-1.0',
                #gir_path     = '/tmp',
                #vapi_path = '/tmp',
                #pkg_name = 'hello'
                # disable installing of gir, vapi and header
                #install_binding = False

                # profile     = 'xyz' # adds --profile=<xyz> to enable profiling
                # thread      = True, # adds --thread, except if profile is on or not on 'gobject'
                # vala_target_glib = 'xyz' # adds --target-glib=<xyz>, can be given through the command-line option --vala-target-glib=<xyz>
        )
Parameters

node (waflib.Node.Node) – vala file

waflib.Tools.vala.find_valac(self, valac_name, min_version)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Find the valac program, and execute it to store the version number in conf.env.VALAC_VERSION

Parameters
  • valac_name (string or list of string) – program name

  • min_version (tuple of int) – minimum version acceptable

waflib.Tools.vala.check_vala(self, min_version=(0, 8, 0), branch=None)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check if vala compiler from a given branch exists of at least a given version.

Parameters
  • min_version (tuple) – minimum version acceptable (0.8.0)

  • branch (tuple of int) – first part of the version number, in case a snapshot is used (0, 8)

waflib.Tools.vala.check_vala_deps(self)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Load the gobject and gthread packages if they are missing.

waflib.Tools.vala.configure(self)[source]

Use the following to enforce minimum vala version:

def configure(conf):
        conf.env.VALA_MINVER = (0, 10, 0)
        conf.load('vala')
waflib.Tools.vala.options(opt)[source]

Load the waflib.Tools.gnu_dirs tool and add the --vala-target-glib command-line option