From 3a9e1571458f931b6d6a268ad628bfac88655df3 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 21 Jun 2016 09:43:29 -0400 Subject: [PATCH 1/5] Fix saving visualizations --- lib/galaxy/webapps/galaxy/api/visualizations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/visualizations.py b/lib/galaxy/webapps/galaxy/api/visualizations.py index 7f40a214d1f..8d768c2b4c3 100644 --- a/lib/galaxy/webapps/galaxy/api/visualizations.py +++ b/lib/galaxy/webapps/galaxy/api/visualizations.py @@ -15,7 +15,7 @@ from galaxy.web import _future_expose_api as expose_api from galaxy import web from galaxy import util from galaxy import exceptions - +import json import logging log = logging.getLogger( __name__ ) @@ -136,7 +136,7 @@ class VisualizationsController( BaseAPIController, UsesVisualizationMixin, Shara latest_config = visualization.latest_revision.config if( ( title != visualization.latest_revision.title ) or ( dbkey != visualization.latest_revision.dbkey ) or - ( util.json.dumps( config ) != util.json.dumps( latest_config ) ) ): + ( json.dumps( config ) != json.dumps( latest_config ) ) ): revision = self.add_visualization_revision( trans, visualization, config, title, dbkey ) rval = { 'id' : id, 'revision' : revision.id } From 41baf5d107b23b1761bfc5f4769f08f7b68c692e Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 21 Jun 2016 10:26:02 -0400 Subject: [PATCH 2/5] Fix library common json loads call --- lib/galaxy/webapps/galaxy/controllers/library_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/library_common.py b/lib/galaxy/webapps/galaxy/controllers/library_common.py index 02050585bf6..49cbfcc1790 100644 --- a/lib/galaxy/webapps/galaxy/controllers/library_common.py +++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py @@ -2751,7 +2751,7 @@ def lucene_search( trans, cntrller, search_term, search_url, **kwd ): status = kwd.get( 'status', 'done' ) full_url = "%s/find?%s" % ( search_url, urllib.urlencode( { "kwd" : search_term } ) ) response = urllib2.urlopen( full_url ) - ldda_ids = util.json.loads( response.read() )[ "ids" ] + ldda_ids = loads( response.read() )[ "ids" ] response.close() lddas = [ trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( ldda_id ) for ldda_id in ldda_ids ] return status, message, get_sorted_accessible_library_items( trans, cntrller, lddas, 'name' ) From ac902304ae6f64dc9c9f313a12572bcfb7769d06 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 16 Jun 2016 16:10:36 -0400 Subject: [PATCH 3/5] Fix two errors in sff_extract.py detected by flake8 -- either of these code paths would have thrown an exception and failed prior to this. --- tools/filters/sff_extract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/filters/sff_extract.py b/tools/filters/sff_extract.py index 06158434f19..2268442463e 100644 --- a/tools/filters/sff_extract.py +++ b/tools/filters/sff_extract.py @@ -231,7 +231,7 @@ def sequences(fileh, header): while True: if fposition == header['index_offset']: # we have to skip the index section - fposition += index_length + fposition += header['index_length'] continue else: bytes_read, seq_data = read_sequence(header=header, fileh=fileh, @@ -276,7 +276,7 @@ def remove_last_xmltag_in_file(fname, tag=None): # we check that we're removing the asked tag if tag is not None and tag != last_tag: - etxt = join('The given xml tag (', tag, ') was not the last one in the file') + etxt = 'The given xml tag (%s) was not the last one in the file' % tag raise RuntimeError(etxt) # while we are at it: also remove all white spaces in that line :-) From 4bfa2f62fb1b04d8e05e5edca17fab319bbc4f8b Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 21 Jun 2016 17:56:26 +0100 Subject: [PATCH 4/5] Fix for py34-lint --- lib/galaxy/jobs/runners/util/job_script/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/runners/util/job_script/__init__.py b/lib/galaxy/jobs/runners/util/job_script/__init__.py index edd8fb31b9a..d77281ecc5d 100644 --- a/lib/galaxy/jobs/runners/util/job_script/__init__.py +++ b/lib/galaxy/jobs/runners/util/job_script/__init__.py @@ -4,6 +4,7 @@ import subprocess import time from pkg_resources import resource_string +from six import text_type from galaxy.util import unicodify DEFAULT_SHELL = '/bin/sh' @@ -96,7 +97,7 @@ def check_script_integrity(config): def write_script(path, contents, config, mode=0o755): with open(path, 'w') as f: - if isinstance(contents, unicode): + if isinstance(contents, text_type): contents = contents.encode("UTF-8") f.write(contents) os.chmod(path, mode) From 89890d4f60452a9fc55d924fd960f4bd72ddbb12 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 21 Jun 2016 17:46:18 +0100 Subject: [PATCH 5/5] Fix move_directory_files tool dependency action when destination is not empty Historically this action moves the contents of the source directory to the destination directory. Commit d38936bd8d9b3612dc0718859067e299651e6c86 broke the install when e.g. the destination is $INSTALL_DIR, which is created by Galaxy and is not empty (contains INSTALLATION.log after first action). --- .../tool_dependencies/recipe/step_handler.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py index ed480293ba7..b12e9d0a673 100755 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py @@ -847,11 +847,17 @@ class MoveDirectoryFiles( RecipeStep ): def move_directory_files( self, current_dir, source_dir, destination_dir ): source_directory = os.path.abspath( os.path.join( current_dir, source_dir ) ) - destination_directory = os.path.join( destination_dir ) - destination_parent_directory = os.path.dirname(destination_directory) - if not os.path.isdir( destination_parent_directory ): - os.makedirs( destination_parent_directory ) - shutil.move( source_directory, destination_directory ) + destination_directory = os.path.abspath(os.path.join(destination_dir)) + if not os.path.isdir(destination_directory): + os.makedirs(destination_directory) + for dir_entry in os.listdir(source_directory): + source_entry = os.path.join(source_directory, dir_entry) + if os.path.islink(source_entry): + destination_entry = os.path.join(destination_directory, dir_entry) + os.symlink(os.readlink(source_entry), destination_entry) + os.remove(source_entry) + else: + shutil.move(source_entry, destination_directory) def prepare_step( self, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ): #