def remove_tool_dependency(app, tool_dependency):
 context = app.install_model.context
 dependency_install_dir = tool_dependency.installation_directory(app)
 (removed, error_message) = remove_tool_dependency_installation_directory(dependency_install_dir)
 if removed:
  tool_dependency.status = app.install_model.ToolDependency.installation_status.UNINSTALLED
  tool_dependency.error_message = None
  context.add(tool_dependency)
  context.flush()
 return (removed, error_message)

def remove_tool_dependency ( app , tool_dependency ) : context = app . install_model . context dependency_install_dir = tool_dependency . installation_directory ( app ) ( removed , error_message ) = remove_tool_dependency_installation_directory ( dependency_install_dir ) if removed : tool_dependency . status = app . install_model . ToolDependency . installation_status . UNINSTALLED tool_dependency . error_message = None context . add ( tool_dependency ) context . flush ( ) return ( removed , error_message )
the received tool_dependency must be in an error state .