Create buildout directory

def create(buildout_directory, buildout_extends):
    """Create buildout directory
    """
    ##
    # Resolve arguments
    directory = get_buildout_directory(buildout_directory)
    extends = get_buildout_extends(buildout_extends)

    ##
    # Create buildout directory
    local('mkdir -p {0:s}'.format(directory))

    ##
    # Create buildout.cfg
    filename = os.path.join(directory, 'buildout.cfg')
    contents = """\
[buildout]
extends = {0:s}
""".format(extends)

    ##
    # Write buildout.cfg
    with NamedTemporaryFile() as output:
        print("[localhost] create: {0:s}".format(output.name))
        output.write(contents)
        output.flush()
        local('cp {0:s} {1:s}'.format(output.name, filename))
        local('chmod a+r {0:s}'.format(filename))