qibuild.worktree – Using a worktree

qibuild.worktree.WorkTree

class qibuild.worktree.WorkTree(work_tree, path_hints=None)

This class represent a worktree

__init__(work_tree, path_hints=None)

Construct a new worktree

Parameters:
  • work_tree – The directory to be used as a worktree.
  • path_hints – Some additional directories to be used when searching for projects.
Raise :

WorkTreeException if two projects have the same name or if two git directories have the same basename

work_tree

The root of the work tree.

buildable_projects

A dict {name : Project} of projects found in this worktree Initialized with

git_projects

A dict {name : path} of git repostories found in this worktree

Other functions in this module

qibuild.worktree.worktree_open

qibuild.worktree.worktree_open(work_tree=None)

Open a qi worktree.

Returns:a valid WorkTree instance. If worktree is None, guess it from the current working dir.

Typical usage from an action is:

# To handle --work-tree option
def configure_parser(parser):
    qibuild.worktree.work_tree_parser(parser)

def do(args):
    qiwt = qibuild.worktree_open(args.work_tree)

qibuild.worktree.search_current_project_root

qibuild.worktree.search_current_project_root(working_directory)

Try to guess the current project directory using the current working dir.

Two cases:
  • inside a subdir of qibuild project: look for a qibuild.manifest
  • inside the build directory of a qibuild project: search a cmake build directory, and guess the project from the contents of the cmake cache.