diff --git a/lib/galaxy/webapps/tool_shed/search/tool_search.py b/lib/galaxy/webapps/tool_shed/search/tool_search.py index 19d324166e0..19d11056ca6 100644 --- a/lib/galaxy/webapps/tool_shed/search/tool_search.py +++ b/lib/galaxy/webapps/tool_shed/search/tool_search.py @@ -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' ) diff --git a/scripts/tool_shed/build_ts_whoosh_index.py b/scripts/tool_shed/build_ts_whoosh_index.py index 78954de35e5..d9b335c4510 100644 --- a/scripts/tool_shed/build_ts_whoosh_index.py +++ b/scripts/tool_shed/build_ts_whoosh_index.py @@ -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 )