From 7142248e04ee5046e34ced0fbb8333bf1da191fd Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Fri, 20 Apr 2012 21:45:30 -0400 Subject: [PATCH] More fixes for setting tool shed repsoitory metadata. --- lib/galaxy/util/shed_util.py | 13 +++++++++---- lib/galaxy/webapps/community/controllers/common.py | 13 +++++++++---- .../webapps/community/controllers/repository.py | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/galaxy/util/shed_util.py b/lib/galaxy/util/shed_util.py index 4d736fa606a..17e87876e3c 100644 --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -411,10 +411,15 @@ def generate_metadata( toolbox, relative_install_dir, repository_clone_url ): full_path = os.path.abspath( os.path.join( root, name ) ) if not ( check_binary( full_path ) or check_image( full_path ) or check_gzip( full_path )[ 0 ] or check_bz2( full_path )[ 0 ] or check_zip( full_path ) ): - # Make sure we're looking at a tool config and not a display application config or something else. - element_tree = util.parse_xml( full_path ) - element_tree_root = element_tree.getroot() - if element_tree_root.tag == 'tool': + try: + # Make sure we're looking at a tool config and not a display application config or something else. + element_tree = util.parse_xml( full_path ) + element_tree_root = element_tree.getroot() + is_tool = element_tree_root.tag == 'tool' + except Exception, e: + log.debug( "Error parsing %s, exception: %s" % ( full_path, str( e ) ) ) + is_tool = False + if is_tool: try: tool = toolbox.load_tool( full_path ) except Exception, e: diff --git a/lib/galaxy/webapps/community/controllers/common.py b/lib/galaxy/webapps/community/controllers/common.py index af936e4afc3..299a4adefcb 100644 --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -323,10 +323,15 @@ def generate_metadata_for_repository_tip( trans, id, ctx, changeset_revision, re full_path = os.path.abspath( os.path.join( root, name ) ) if not ( check_binary( full_path ) or check_image( full_path ) or check_gzip( full_path )[ 0 ] or check_bz2( full_path )[ 0 ] or check_zip( full_path ) ): - # Make sure we're looking at a tool config and not a display application config or something else. - element_tree = util.parse_xml( full_path ) - element_tree_root = element_tree.getroot() - if element_tree_root.tag == 'tool': + try: + # Make sure we're looking at a tool config and not a display application config or something else. + element_tree = util.parse_xml( full_path ) + element_tree_root = element_tree.getroot() + is_tool = element_tree_root.tag == 'tool' + except Exception, e: + log.debug( "Error parsing %s, exception: %s" % ( full_path, str( e ) ) ) + is_tool = False + if is_tool: try: tool = load_tool( trans, full_path ) valid = True diff --git a/lib/galaxy/webapps/community/controllers/repository.py b/lib/galaxy/webapps/community/controllers/repository.py index 650b311dbd7..d4960bfbce9 100644 --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -924,7 +924,8 @@ class RepositoryController( BaseUIController, ItemRatings ): element_tree = util.parse_xml( tmp_filename ) element_tree_root = element_tree.getroot() is_tool = element_tree_root.tag == 'tool' - except: + except Exception, e: + log.debug( "Error parsing %s, exception: %s" % ( tmp_filename, str( e ) ) ) is_tool = False if is_tool: try: