For instance, after
$ qibuild make --release foo
The main function are:
run_action() to call an action
to generate a ‘main’ script, such as bin/qibuild
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)
name : name of the main program parser : an instance of ArgumentParser class modules : list of Python modules
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 = qibuild.cmdparse.action_modules_from_package("qibuild.actions")
qibuild.cmdparse.root_command_main("qibuild", parser, modules)
See also