def _install_application(name, versions, tool_install_dir=None):
    """
    Install single custom tool as Galaxy dependency application.

    TODO: Rename versions and document options.
    """
    if type(versions) is str:
        versions = [versions]
    for version_info in versions:
        if type(version_info) is str:
            _install_tool(env, name, version=version_info, requirement_name=name, tool_install_dir=tool_install_dir)
        else:
            version = version_info["version"]
            bin_dirs = version_info.get("bin_dirs", ["bin"])
            env_vars = version_info.get("env_vars", {})
            provides = version_info.get("provides", [])
            if isinstance(provides, (str, unicode, basestring)):
                provides = [provides]
            for provide_conf in provides[:]:
                if isinstance(provide_conf, dict):
                    provides.remove(provide_conf)
                    if __check_conditional(provide_conf):
                        provies.append(provide_conf["name"])

            # Some requirements (e.g. blast+) maybe not have valid python
            # identifiers as name. Use install_blast to setup but override
            # requirement directory name with requirement_name field.
            requirement_name = version_info.get("requirement_name", name)
            tool_env = _install_tool(env, name, version, bin_dirs=bin_dirs, env_vars=env_vars, requirement_name=requirement_name, tool_install_dir=tool_install_dir)
            symlink_versions = version_info.get("symlink_versions", [])
            if type(symlink_versions) is str:
                symlink_versions = [symlink_versions]
            for symlink_version in symlink_versions:
                _set_default_config(tool_env, tool_env["system_install"], symlink_version)

            if provides:
                install_dir = tool_env["system_install"]
                ## Create additional symlinked packages from this one.
                tool_dir = "%s/.." % install_dir
                tools_dir = "%s/.." % tool_dir
                for package in provides:
                    link_dir = "%s/%s" % (tools_dir, package)
                    env.safe_sudo("ln -f -s '%s' '%s'" % (requirement_name, link_dir))
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/galaxy/tools.py/_install_application/original