2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/12497a97f7d2/ Changeset: 12497a97f7d2 Branch: next-stable User: jmchilton Date: 2014-10-06 01:20:05+00:00 Summary: Back port Kyle's tool download fixes from default. Affected #: 1 file diff -r 105a53b01211993297b7ee64251cf3c1677883f7 -r 12497a97f7d22d08c6fdafe0c544b4f7a906da98 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -742,20 +742,21 @@ tool_xml = file( os.path.abspath( tool.config_file ), 'r' ).read() # Retrieve tool help images and rewrite the tool's xml into a temporary file with the path # modified to be relative to the repository root. - tool_help = tool.help._source image_found = False - # Check each line of the rendered tool help for an image tag that points to a location under static/ - for help_line in tool_help.split( '\n' ): - image_regex = re.compile( 'img alt="[^"]+" src="\${static_path}/([^"]+)"' ) - matches = re.search( image_regex, help_line ) - if matches is not None: - tool_help_image = matches.group(1) - tarball_path = tool_help_image - filesystem_path = os.path.abspath( os.path.join( trans.app.config.root, 'static', tool_help_image ) ) - if os.path.exists( filesystem_path ): - tarball_files.append( ( filesystem_path, tarball_path ) ) - image_found = True - tool_xml = tool_xml.replace( '${static_path}/%s' % tarball_path, tarball_path ) + if tool.help is not None: + tool_help = tool.help._source + # Check each line of the rendered tool help for an image tag that points to a location under static/ + for help_line in tool_help.split( '\n' ): + image_regex = re.compile( 'img alt="[^"]+" src="\${static_path}/([^"]+)"' ) + matches = re.search( image_regex, help_line ) + if matches is not None: + tool_help_image = matches.group(1) + tarball_path = tool_help_image + filesystem_path = os.path.abspath( os.path.join( trans.app.config.root, 'static', tool_help_image ) ) + if os.path.exists( filesystem_path ): + tarball_files.append( ( filesystem_path, tarball_path ) ) + image_found = True + tool_xml = tool_xml.replace( '${static_path}/%s' % tarball_path, tarball_path ) # If one or more tool help images were found, add the modified tool XML to the tarball instead of the original. if image_found: fd, new_tool_config = tempfile.mkstemp( suffix='.xml' ) @@ -767,7 +768,7 @@ tool_tup = ( os.path.abspath( tool.config_file ), os.path.split( tool.config_file )[-1] ) tarball_files.append( tool_tup ) # TODO: This feels hacky. - tool_command = tool.command.split( ' ' )[0] + tool_command = tool.command.strip().split( ' ' )[0] tool_path = os.path.dirname( os.path.abspath( tool.config_file ) ) # Add the tool XML to the tuple that will be used to populate the tarball. if os.path.exists( os.path.join( tool_path, tool_command ) ): https://bitbucket.org/galaxy/galaxy-central/commits/342ee791fe55/ Changeset: 342ee791fe55 User: jmchilton Date: 2014-10-06 01:25:01+00:00 Summary: Merge next-stable fixes to tool downloader. Affected #: 1 file diff -r 1daa729f4e72be6e6b3670b78bc652f857bbe933 -r 342ee791fe55b3bca0bbbe86c2e58509a9f96df6 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -789,9 +789,9 @@ tool_xml = file( os.path.abspath( tool.config_file ), 'r' ).read() # Retrieve tool help images and rewrite the tool's xml into a temporary file with the path # modified to be relative to the repository root. + image_found = False if tool.help is not None: tool_help = tool.help._source - image_found = False # Check each line of the rendered tool help for an image tag that points to a location under static/ for help_line in tool_help.split( '\n' ): image_regex = re.compile( 'img alt="[^"]+" src="\${static_path}/([^"]+)"' ) @@ -804,16 +804,16 @@ tarball_files.append( ( filesystem_path, tarball_path ) ) image_found = True tool_xml = tool_xml.replace( '${static_path}/%s' % tarball_path, tarball_path ) - # If one or more tool help images were found, add the modified tool XML to the tarball instead of the original. - if image_found: - fd, new_tool_config = tempfile.mkstemp( suffix='.xml' ) - os.close( fd ) - file( new_tool_config, 'w' ).write( tool_xml ) - tool_tup = ( os.path.abspath( new_tool_config ), os.path.split( tool.config_file )[-1] ) - temp_files.append( os.path.abspath( new_tool_config ) ) - else: - tool_tup = ( os.path.abspath( tool.config_file ), os.path.split( tool.config_file )[-1] ) - tarball_files.append( tool_tup ) + # If one or more tool help images were found, add the modified tool XML to the tarball instead of the original. + if image_found: + fd, new_tool_config = tempfile.mkstemp( suffix='.xml' ) + os.close( fd ) + file( new_tool_config, 'w' ).write( tool_xml ) + tool_tup = ( os.path.abspath( new_tool_config ), os.path.split( tool.config_file )[-1] ) + temp_files.append( os.path.abspath( new_tool_config ) ) + else: + tool_tup = ( os.path.abspath( tool.config_file ), os.path.split( tool.config_file )[-1] ) + tarball_files.append( tool_tup ) # TODO: This feels hacky. tool_command = tool.command.strip().split( ' ' )[0] tool_path = os.path.dirname( os.path.abspath( tool.config_file ) ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.