def buildout(directory='.',
             config='buildout.cfg',
             parts=None,
             runas=None,
             env=(),
             buildout_ver=None,
             test_release=False,
             distribute=None,
             new_st=None,
             offline=False,
             newest=False,
             python=sys.executable,
             debug=False,
             verbose=False,
             onlyif=None,
             unless=None,
             use_vt=False,
             loglevel=None):
    '''
    Run buildout in a directory.

    directory
        directory to execute in

    config
        buildout config to use

    parts
        specific buildout parts to run

    runas
        user used to run buildout as

    env
        environment variables to set when running

    buildout_ver
        force a specific buildout version (1 | 2)

    test_release
        buildout accept test release

    new_st
        Forcing use of setuptools >= 0.7

    distribute
        use distribute over setuptools if possible

    offline
        does buildout run offline

    python
        python to use

    debug
        run buildout with -D debug flag

    onlyif
        Only execute cmd if statement on the host return 0

    unless
        Do not execute cmd if statement on the host return 0
    newest
        run buildout in newest mode

    verbose
        run buildout in verbose mode (-vvvvv)

    use_vt
        Use the new salt VT to stream output [experimental]

    CLI Example:

    .. code-block:: bash

        salt '*' buildout.buildout /srv/mybuildout
    '''
    LOG.info('Running buildout in {0} ({1})'.format(directory, config))  # pylint: disable=str-format-in-logging
    boot_ret = bootstrap(directory,
                         config=config,
                         buildout_ver=buildout_ver,
                         test_release=test_release,
                         offline=offline,
                         new_st=new_st,
                         env=env,
                         runas=runas,
                         distribute=distribute,
                         python=python,
                         use_vt=use_vt,
                         loglevel=loglevel)
    buildout_ret = run_buildout(directory=directory,
                                config=config,
                                parts=parts,
                                offline=offline,
                                newest=newest,
                                runas=runas,
                                env=env,
                                verbose=verbose,
                                debug=debug,
                                use_vt=use_vt,
                                loglevel=loglevel)
    # signal the decorator or our return
    return _merge_statuses([boot_ret, buildout_ret])
Run buildout in a directory.

    directory
        directory to execute in

    config
        buildout config to use

    parts
        specific buildout parts to run

    runas
        user used to run buildout as

    env
        environment variables to set when running

    buildout_ver
        force a specific buildout version (1 | 2)

    test_release
        buildout accept test release

    new_st
        Forcing use of setuptools >= 0.7

    distribute
        use distribute over setuptools if possible

    offline
        does buildout run offline

    python
        python to use

    debug
        run buildout with -D debug flag

    onlyif
        Only execute cmd if statement on the host return 0

    unless
        Do not execute cmd if statement on the host return 0
    newest
        run buildout in newest mode

    verbose
        run buildout in verbose mode (-vvvvv)

    use_vt
        Use the new salt VT to stream output [experimental]

    CLI Example:

    .. code-block:: bash

        salt '*' buildout.buildout /srv/mybuildout