def create_or_update_tool_dependency(app, tool_shed_repository, name, version, type, status, set_status=True):
 context = app.install_model.context
 if version:
  tool_dependency = get_tool_dependency_by_name_version_type_repository(app, tool_shed_repository, name, version, type)
 else:
  tool_dependency = get_tool_dependency_by_name_type_repository(app, tool_shed_repository, name, type)
 if tool_dependency:
  if set_status:
   set_tool_dependency_attributes(app, tool_dependency=tool_dependency, status=status)
 else:
  debug_msg = ('Creating a new record for version %s of tool dependency %s for revision %s of repository %s.  ' % (str(version), str(name), str(tool_shed_repository.changeset_revision), str(tool_shed_repository.name)))
  debug_msg += ('The status is being set to %s.' % str(status))
  log.debug(debug_msg)
  tool_dependency = app.install_model.ToolDependency(tool_shed_repository.id, name, version, type, status)
  context.add(tool_dependency)
  context.flush()
 return tool_dependency

def create_or_update_tool_dependency ( app , tool_shed_repository , name , version , type , status , set_status = True ) : context = app . install_model . context if version : tool_dependency = get_tool_dependency_by_name_version_type_repository ( app , tool_shed_repository , name , version , type ) else : tool_dependency = get_tool_dependency_by_name_type_repository ( app , tool_shed_repository , name , type ) if tool_dependency : if set_status : set_tool_dependency_attributes ( app , tool_dependency = tool_dependency , status = status ) else : debug_msg = ( 'Creating a new record for version %s of tool dependency %s for revision %s of repository %s.  ' % ( str ( version ) , str ( name ) , str ( tool_shed_repository . changeset_revision ) , str ( tool_shed_repository . name ) ) ) debug_msg += ( 'The status is being set to %s.' % str ( status ) ) log . debug ( debug_msg ) tool_dependency = app . install_model . ToolDependency ( tool_shed_repository . id , name , version , type , status ) context . add ( tool_dependency ) context . flush ( ) return tool_dependency
create or update a tool_dependency record in the galaxy database .