Install one or more resources.

    The resource(s) will be fetched, if necessary, and different resource
    types are handled appropriately (e.g., PyPI resources are installed
    with ``pip``, archive file resources are extracted, non-archive file
    resources are copied, etc).

    For PyPI resources, this is roughly equivalent to the following::

        pip install `juju-resources resource_spec $resource` -i $mirror_url

    :param list which: A name, or a list of one or more resource names, to
        fetch.  If ommitted, all non-optional resources are installed.
    :param str mirror_url: Fetch resources from the given mirror.
    :param str destination: Destination to which to extract or copy file resources.
    :param bool skip_top_level: When extracting archive file resources, skip
        all members that are at the top level of the archive and instead extract
        all nested members directly into ``destination``.  E.g., an archive
        containing ``foo/bar.txt`` and ``foo/qux/baz.txt`` will be extracted as
        ``destination/bar.txt`` and ``destination/qux/baz.txt``.
    :param str resources_yaml: Location of the yaml file containing the
        resource descriptions (default: ``resources.yaml``).
        Can be a local file name or a remote URL.
    :returns: True if all resources were successfully installed.

def install(which=None, mirror_url=None, destination=None, skip_top_level=False,
            resources_yaml='resources.yaml'):
    """
    Install one or more resources.

    The resource(s) will be fetched, if necessary, and different resource
    types are handled appropriately (e.g., PyPI resources are installed
    with ``pip``, archive file resources are extracted, non-archive file
    resources are copied, etc).

    For PyPI resources, this is roughly equivalent to the following::

        pip install `juju-resources resource_spec $resource` -i $mirror_url

    :param list which: A name, or a list of one or more resource names, to
        fetch.  If ommitted, all non-optional resources are installed.
    :param str mirror_url: Fetch resources from the given mirror.
    :param str destination: Destination to which to extract or copy file resources.
    :param bool skip_top_level: When extracting archive file resources, skip
        all members that are at the top level of the archive and instead extract
        all nested members directly into ``destination``.  E.g., an archive
        containing ``foo/bar.txt`` and ``foo/qux/baz.txt`` will be extracted as
        ``destination/bar.txt`` and ``destination/qux/baz.txt``.
    :param str resources_yaml: Location of the yaml file containing the
        resource descriptions (default: ``resources.yaml``).
        Can be a local file name or a remote URL.
    :returns: True if all resources were successfully installed.
    """
    resources = _load(resources_yaml, None)
    return _install(resources, which, mirror_url, destination, skip_top_level)