def _build_tool_env(env, name, version, tool_install_dir):
    """ Build new env to have tool installed for Galaxy instead of into /usr. """
    tool_env = {"tool_version": version,
                "galaxy_tool_install": True}
    for key, value in env.iteritems():
        tool_env[key] = value
    if not tool_install_dir:
        tool_install_dir = os.path.join(env.galaxy_tools_dir, name, version)
    tool_env["system_install"] = tool_install_dir
    tool_env["local_install"] = tool_install_dir
    tool_env["venv_directory"] = "%s/%s" % (tool_env["system_install"], "venv")
    return AttributeDict(tool_env)
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/galaxy/tools.py/_build_tool_env/original