mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #563 from martenson/release_15.07
[release_15.07] Fixes for TS search API
This commit is contained in:
@@ -77,7 +77,7 @@ class ToolSearch( object ):
|
||||
results[ 'hits' ] = []
|
||||
for hit in hits:
|
||||
hit_dict = {}
|
||||
hit_dict[ 'id' ] = trans.security.encode_id( hit.get( 'id' ) )
|
||||
hit_dict[ 'id' ] = hit.get( 'id' )
|
||||
hit_dict[ 'repo_owner_username' ] = hit.get( 'repo_owner_username' )
|
||||
hit_dict[ 'repo_name' ] = hit.get( 'repo_name' )
|
||||
hit_dict[ 'name' ] = hit.get( 'name' )
|
||||
|
||||
@@ -161,21 +161,13 @@ def get_repos( sa_session, path_to_repositories ):
|
||||
path = os.path.join( path_to_repositories, *model.directory_hash_id( repo.id ))
|
||||
path = os.path.join( path, "repo_%d" % repo.id )
|
||||
if os.path.exists(path):
|
||||
tool_elems = load_tool_elements_from_path(path)
|
||||
if tool_elems:
|
||||
for elem in tool_elems:
|
||||
root = elem[1].getroot()
|
||||
if root.tag == 'tool':
|
||||
tool = {}
|
||||
if root.find('help') is not None:
|
||||
tool.update( dict( help=root.find( 'help' ).text ) )
|
||||
if root.find('description') is not None:
|
||||
tool.update( dict( description=root.find( 'description' ).text ) )
|
||||
tool.update( dict( id=root.attrib.get('id'),
|
||||
name=root.attrib.get('name'),
|
||||
version=root.attrib.get('version') ) )
|
||||
|
||||
tools_list.append( tool )
|
||||
tools_list.extend( load_one_dir( path ) )
|
||||
for root, dirs, files in os.walk( path ):
|
||||
if '.hg' in dirs:
|
||||
dirs.remove('.hg')
|
||||
for name in dirs:
|
||||
tools_in_dir = load_one_dir( os.path.join( root, name ) )
|
||||
tools_list.extend( tools_in_dir )
|
||||
|
||||
results.append(dict( id=repo_id,
|
||||
name=name,
|
||||
@@ -192,6 +184,25 @@ def get_repos( sa_session, path_to_repositories ):
|
||||
return results
|
||||
|
||||
|
||||
def load_one_dir( path ):
|
||||
tools_in_dir = []
|
||||
tool_elems = load_tool_elements_from_path( path )
|
||||
if tool_elems:
|
||||
for elem in tool_elems:
|
||||
root = elem[1].getroot()
|
||||
if root.tag == 'tool':
|
||||
tool = {}
|
||||
if root.find( 'help' ) is not None:
|
||||
tool.update( dict( help=root.find( 'help' ).text ) )
|
||||
if root.find( 'description' ) is not None:
|
||||
tool.update( dict( description=root.find( 'description' ).text ) )
|
||||
tool.update( dict( id=root.attrib.get( 'id' ),
|
||||
name=root.attrib.get( 'name' ),
|
||||
version=root.attrib.get( 'version' ) ) )
|
||||
tools_in_dir.append( tool )
|
||||
return tools_in_dir
|
||||
|
||||
|
||||
def get_sa_session_and_needed_config_settings( path_to_tool_shed_config ):
|
||||
conf_parser = ConfigParser.ConfigParser( { 'here' : os.getcwd() } )
|
||||
conf_parser.read( path_to_tool_shed_config )
|
||||
|
||||
Reference in New Issue
Block a user