qiBuild documentation

qisys.script – Tools for qibuild scripts

Functions defined in this module

qisys.script.run_action(module_name, args=None, forward_args=None)

Run an action using its module path and a list of arguments

If forward_args is given, it must be an argparse.Namespace object. This namespace will be merged with args before being passed to the do() method of module_name.

Example of use

# Configure, build, and run tests on the "foo" project:

def do(args):
    # Forward the --release example to every action:
    qibuild.run_action("qibuild.actions.configure",
      ["foo"], forward_args=args)
    qibuild.run_action("qibuild.actions.make",
      ["foo"], forward_args=args)
    qibuild.run_action("qibuild.actions.test",
      ["foo"], forward_args=args)
qisys.script.root_command_main(name, parser, modules, args=None)

name : name of the main program parser : an instance of ArgumentParser class modules : list of Python modules

qisys.script.action_modules_from_package(package_name)

Returns a suitable list of modules from a package.

Example: assuming you have: actions/foo/__init__.py actions/foo/spam.py actions/foo/eggs.py

then action_modules_from_package(“actions.foo”) returns: [actions.foo.spam, actions.foo.eggs]

Example of usage:

parser = argparse.ArgumentParser()
modules = qisys.script.action_modules_from_package("qibuild.actions")
qisys.script.root_command_main("qibuild", parser, modules)