1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/20e01e610de0/ changeset: 20e01e610de0 user: greg date: 2012-06-25 21:46:35 summary: Implement support for handling refined xml definition for installing tool dependencies along with installed tool shed repositories. affected #: 7 files diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f lib/galaxy/tool_shed/install_manager.py --- a/lib/galaxy/tool_shed/install_manager.py +++ b/lib/galaxy/tool_shed/install_manager.py @@ -149,6 +149,11 @@ repository_clone_url, metadata_dict, dist_to_shed=True ) + if 'tool_dependencies' in metadata_dict: + # All tool_dependency objects must be created before the tools are processed no matter whether tool dependencies are going to be installed. + tool_dependencies = create_tool_dependency_objects( self.app, tool_shed_repository, installed_changeset_revision ) + else: + tool_dependencies = None if 'tools' in metadata_dict: work_dir = make_tmp_directory() repository_tools_tups = get_repository_tools_tups( self.app, metadata_dict ) @@ -165,7 +170,7 @@ repository_tools_tups, sample_files_copied = handle_missing_index_file( self.app, self.tool_path, sample_files, repository_tools_tups ) # Copy remaining sample files included in the repository to the ~/tool-data directory of the local Galaxy instance. copy_sample_files( self.app, sample_files, sample_files_copied=sample_files_copied ) - if install_dependencies and 'tool_dependencies' in metadata_dict: + if install_dependencies and tool_dependencies and 'tool_dependencies' in metadata_dict: # Get the tool_dependencies.xml file from the repository. tool_dependencies_config = get_config_from_repository( self.app, 'tool_dependencies.xml', @@ -173,12 +178,14 @@ installed_changeset_revision, work_dir ) # Install tool dependencies. - status, message = handle_tool_dependencies( app=self.app, - tool_shed_repository=tool_shed_repository, - tool_dependencies_config=tool_dependencies_config ) - if status != 'done' and message: - print 'The following error occurred from the InstallManager while installing tool dependencies:' - print message + installed_tool_dependencies = handle_tool_dependencies( app=self.app, + tool_shed_repository=tool_shed_repository, + tool_dependencies_config=tool_dependencies_config, + tool_dependencies=tool_dependencies ) + for installed_tool_dependency in installed_tool_dependencies: + if installed_tool_dependency.status == self.app.model.ToolDependency.installation_status.ERROR: + print '\nThe following error occurred from the InstallManager while installing tool dependency ', installed_tool_dependency.name, ':' + print installed_tool_dependency.error_message, '\n\n' add_to_tool_panel( self.app, repository_name, repository_clone_url, diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f lib/galaxy/tool_shed/tool_dependencies/fabric_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py @@ -35,6 +35,7 @@ if os.path.exists( work_dir ): local( 'rm -rf %s' % work_dir ) def handle_post_build_processing( app, tool_dependency, install_dir, env_dependency_path, package_name=None ): + # TODO: This method is deprecated and should be eliminated when the implementation for handling proprietary fabric scripts is implemented. sa_session = app.model.context.current cmd = "echo 'PATH=%s:$PATH; export PATH' > %s/env.sh;chmod +x %s/env.sh" % ( env_dependency_path, install_dir, install_dir ) output = local( cmd, capture=True ) @@ -44,49 +45,84 @@ tool_dependency.error_message = str( output.stderr ) sa_session.add( tool_dependency ) sa_session.flush() -def install_and_build_package( app, tool_dependency, params_dict ): +def install_and_build_package( app, tool_dependency, actions_dict ): """Install a Galaxy tool dependency package either via a url or a mercurial or git clone command.""" sa_session = app.model.context.current - install_dir = params_dict[ 'install_dir' ] - download_url = params_dict.get( 'download_url', None ) - clone_cmd = params_dict.get( 'clone_cmd', None ) - actions = params_dict.get( 'actions', None ) - package_name = params_dict.get( 'package_name', None ) - with make_tmp_dir() as work_dir: - with lcd( work_dir ): - if download_url: - downloaded_filename = os.path.split( download_url )[ -1 ] - downloaded_file_path = common_util.url_download( work_dir, downloaded_filename, download_url ) - if common_util.istar( downloaded_file_path ): - common_util.extract_tar( downloaded_file_path, work_dir ) - dir = common_util.tar_extraction_directory( work_dir, downloaded_filename ) - else: - dir = work_dir - elif clone_cmd: - output = local( clone_cmd, capture=True ) - log_results( clone_cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) ) - if output.return_code: - tool_dependency.status = app.model.ToolDependency.installation_status.ERROR - tool_dependency.error_message = str( output.stderr ) - sa_session.add( tool_dependency ) - sa_session.flush() - return - dir = package_name - if actions: - with lcd( dir ): - current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) - for action_tup in actions: - action_key, action_dict = action_tup - if action_key == 'move_directory_files': + install_dir = actions_dict[ 'install_dir' ] + package_name = actions_dict[ 'package_name' ] + #download_url = actions_dict.get( 'download_url', None ) + #clone_cmd = actions_dict.get( 'clone_cmd', None ) + actions = actions_dict.get( 'actions', None ) + if actions: + with make_tmp_dir() as work_dir: + with lcd( work_dir ): + # The first action in the list of actions will be the one that defines the installation process. There + # are currently only two supported processes; download_by_url and clone via a "shell_command" action type. + action_type, action_dict = actions[ 0 ] + if action_type == 'download_by_url': + # <action type="download_by_url">http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2</action> + url = action_dict[ 'url' ] + downloaded_filename = os.path.split( url )[ -1 ] + downloaded_file_path = common_util.url_download( work_dir, downloaded_filename, url ) + if common_util.istar( downloaded_file_path ): + common_util.extract_tar( downloaded_file_path, work_dir ) + dir = common_util.tar_extraction_directory( work_dir, downloaded_filename ) + else: + dir = work_dir + elif action_type == 'shell_command': + # <action type="shell_command">git clone --recursive git://github.com/ekg/freebayes.git</action> + clone_cmd = action_dict[ 'command' ] + output = local( clone_cmd, capture=True ) + log_results( clone_cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) ) + if output.return_code: + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = str( output.stderr ) + sa_session.add( tool_dependency ) + sa_session.flush() + return + dir = package_name + if not os.path.exists( dir ): + os.makedirs( dir ) + # The package has been down-loaded, so we can now perform all of the actions defined for building it. + with lcd( dir ): + for action_tup in actions[ 1: ]: + action_type, action_dict = action_tup + current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) + if action_type == 'move_directory_files': common_util.move_directory_files( current_dir=current_dir, source_dir=os.path.join( action_dict[ 'source_directory' ] ), destination_dir=os.path.join( action_dict[ 'destination_directory' ] ) ) - elif action_key == 'move_file': + elif action_type == 'move_file': common_util.move_file( current_dir=current_dir, source=os.path.join( action_dict[ 'source' ] ), destination_dir=os.path.join( action_dict[ 'destination' ] ) ) - else: - action = action_key + elif action_type == 'set_environment': + # Currently the only action supported in this category is "environment_variable". + env_var_dict = action_dict[ 'environment_variable' ] + env_var_name = env_var_dict[ 'name' ] + env_var_action = env_var_dict[ 'action' ] + env_var_value = env_var_dict[ 'value' ] + if env_var_action == 'prepend_to': + changed_value = '%s:$%s' % ( env_var_value, env_var_name ) + elif env_var_action == 'set_to': + changed_value = '%s' % env_var_value + elif env_var_action == 'append_to': + changed_value = '$%s:%s' % ( env_var_name, env_var_value ) + cmd = "echo '%s=%s; export %s' > %s/env.sh;chmod +x %s/env.sh" % ( env_var_name, + changed_value, + env_var_name, + install_dir, + install_dir ) + output = local( cmd, capture=True ) + log_results( cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) ) + if output.return_code: + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = str( output.stderr ) + sa_session.add( tool_dependency ) + sa_session.flush() + return + elif action_type == 'shell_command': + action = action_dict[ 'command' ] with settings( warn_only=True ): output = local( action, capture=True ) log_results( action, output, os.path.join( install_dir, INSTALLATION_LOG ) ) diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f lib/galaxy/tool_shed/tool_dependencies/install_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/install_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/install_util.py @@ -51,117 +51,109 @@ install_dir = get_tool_dependency_install_dir( app, tool_shed_repository, package_name, package_version ) if not os.path.exists( install_dir ): for package_elem in elem: - if package_elem.tag == 'proprietary_fabfile': - # TODO: This is not yet working... - # Handle tool dependency installation where the repository includes one or more proprietary fabric scripts. - if not fabric_version_checked: - check_fabric_version() - fabric_version_checked = True - fabfile_name = package_elem.get( 'name', None ) - fabfile_path = os.path.abspath( os.path.join( os.path.split( tool_dependencies_config )[ 0 ], fabfile_name ) ) - print 'Installing tool dependencies via fabric script ', fabfile_path - elif package_elem.tag == 'fabfile': - # Handle tool dependency installation using a fabric method included in the Galaxy framework. - fabfile_path = None - for method_elem in package_elem: + if package_elem.tag == 'install': + # <install version="1.0"> + package_install_version = package_elem.get( 'version', '1.0' ) tool_dependency = create_or_update_tool_dependency( app, tool_shed_repository, name=package_name, version=package_version, type='package', status=app.model.ToolDependency.installation_status.INSTALLING ) - run_fabric_method( app, tool_dependency, method_elem, fabfile_path, install_dir, package_name=package_name ) - sa_session.refresh( tool_dependency ) - if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - print package_name, 'version', package_version, 'installed in', install_dir + if package_install_version == '1.0': + # Handle tool dependency installation using a fabric method included in the Galaxy framework. + for actions_elem in package_elem: + install_via_fabric( app, tool_dependency, actions_elem, install_dir, package_name=package_name ) + sa_session.refresh( tool_dependency ) + if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: + print package_name, 'version', package_version, 'installed in', install_dir + elif package_elem.tag == 'readme': + # Nothing to be done. + continue + #elif package_elem.tag == 'proprietary_fabfile': + # # TODO: This is not yet supported or functionally correct... + # # Handle tool dependency installation where the repository includes one or more proprietary fabric scripts. + # if not fabric_version_checked: + # check_fabric_version() + # fabric_version_checked = True + # fabfile_name = package_elem.get( 'name', None ) + # proprietary_fabfile_path = os.path.abspath( os.path.join( os.path.split( tool_dependencies_config )[ 0 ], fabfile_name ) ) + # print 'Installing tool dependencies via fabric script ', proprietary_fabfile_path else: print '\nSkipping installation of tool dependency', package_name, 'version', package_version, 'since it is installed in', install_dir, '\n' return tool_dependency -def run_fabric_method( app, tool_dependency, elem, fabfile_path, install_dir, package_name=None, **kwd ): - """Parse a tool_dependency.xml file's fabfile <method> tag set to build the method parameters and execute the method.""" +def install_via_fabric( app, tool_dependency, actions_elem, install_dir, package_name=None, proprietary_fabfile_path=None, **kwd ): + """Parse a tool_dependency.xml file's <actions> tag set to gather information for the installation via fabric.""" sa_session = app.model.context.current if not os.path.exists( install_dir ): os.makedirs( install_dir ) - # Default value for env_dependency_path. - install_path, install_directory = os.path.split( install_dir ) - if install_directory != 'bin': - env_dependency_path = os.path.join( install_dir, 'bin' ) + actions_dict = dict( install_dir=install_dir ) + if package_name: + actions_dict[ 'package_name' ] = package_name + actions = [] + for action_elem in actions_elem: + action_dict = {} + action_type = action_elem.get( 'type', 'shell_command' ) + if action_type == 'shell_command': + # <action type="shell_command">make</action> + action_elem_text = action_elem.text.replace( '$INSTALL_DIR', install_dir ) + if action_elem_text: + action_dict[ 'command' ] = action_elem_text + else: + continue + elif action_type == 'download_by_url': + # <action type="download_by_url">http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2</action> + if action_elem.text: + action_dict[ 'url' ] = action_elem.text + else: + continue + elif action_type in [ 'move_directory_files', 'move_file' ]: + # <action type="move_file"> + # <source>misc/some_file</source> + # <destination>$INSTALL_DIR/bin</destination> + # </action> + # <action type="move_directory_files"> + # <source_directory>bin</source_directory> + # <destination_directory>$INSTALL_DIR/bin</destination_directory> + # </action> + for move_elem in action_elem: + move_elem_text = move_elem.text.replace( '$INSTALL_DIR', install_dir ) + if move_elem_text: + action_dict[ move_elem.tag ] = move_elem_text + elif action_type == 'set_environment': + # <action type="set_environment"> + # <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> + # </action> + for env_elem in action_elem: + if env_elem.tag == 'environment_variable': + env_var_name = env_elem.get( 'name', 'PATH' ) + env_var_action = env_elem.get( 'action', 'prepend_to' ) + env_var_text = env_elem.text.replace( '$INSTALL_DIR', install_dir ) + if env_var_text: + action_dict[ env_elem.tag ] = dict( name=env_var_name, action=env_var_action, value=env_var_text ) + else: + continue + actions.append( ( action_type, action_dict ) ) + if actions: + actions_dict[ 'actions' ] = actions + if proprietary_fabfile_path: + # TODO: this is not yet supported or functional, but when it is handle it using the fabric api. + # run_proprietary_fabric_method( app, elem, proprietary_fabfile_path, install_dir, package_name=package_name ) + raise Exception( 'Tool dependency installation using proprietary fabric scripts is not yet supported.' ) else: - env_dependency_path = install_dir - method_name = elem.get( 'name', None ) - params_dict = dict( install_dir=install_dir ) - actions = [] - for param_elem in elem: - param_name = param_elem.get( 'name' ) - if param_name: - if param_name == 'actions': - for action_elem in param_elem: - action_dict = {} - action_type = action_elem.get( 'type', 'shell_command' ) - if action_type == 'shell_command': - # Example: <action type="shell_command">make</action> - action_key = action_elem.text.replace( '$INSTALL_DIR', install_dir ) - if not action_key: - continue - elif action_type in [ 'move_directory_files', 'move_file' ]: - # Examples: - # <action type="move_file"> - # <source>misc/some_file</source> - # <destination>$INSTALL_DIR/bin</destination> - # </action> - # <action type="move_directory_files"> - # <source_directory>bin</source_directory> - # <destination_directory>$INSTALL_DIR/bin</destination_directory> - # </action> - action_key = action_type - for move_elem in action_elem: - move_elem_text = move_elem.text.replace( '$INSTALL_DIR', install_dir ) - if move_elem_text: - action_dict[ move_elem.tag ] = move_elem_text - else: - continue - actions.append( ( action_key, action_dict ) ) - if actions: - params_dict[ 'actions' ] = actions - elif param_name == 'env_dependency_path': - env_dependency_path = param_elem.text.replace( '$INSTALL_DIR', install_dir ) - else: - if param_elem.text: - params_dict[ param_name ] = param_elem.text.replace( '$INSTALL_DIR', install_dir ) - if package_name: - params_dict[ 'package_name' ] = package_name - if fabfile_path: - # TODO: Handle this using the fabric api. - # run_proprietary_fabric_method( app, elem, fabfile_path, install_dir, package_name=package_name ) - return 'Tool dependency installation using proprietary fabric scripts is not yet supported. ' - else: - # There is currently only 1 fabric method, install_and_build_package(). try: - install_and_build_package( app, tool_dependency, params_dict ) + # There is currently only one fabric method. + install_and_build_package( app, tool_dependency, actions_dict ) except Exception, e: tool_dependency.status = app.model.ToolDependency.installation_status.ERROR tool_dependency.error_message = str( e ) sa_session.add( tool_dependency ) sa_session.flush() - sa_session.refresh( tool_dependency ) - if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - try: - handle_post_build_processing( app, - tool_dependency, - install_dir, - env_dependency_path, - package_name=package_name ) - except Exception, e: - tool_dependency.status = app.model.ToolDependency.installation_status.ERROR - tool_dependency.error_message = str( e ) - sa_session.add( tool_dependency ) - sa_session.flush() - sa_session.refresh( tool_dependency ) if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: tool_dependency.status = app.model.ToolDependency.installation_status.INSTALLED sa_session.add( tool_dependency ) sa_session.flush() -def run_proprietary_fabric_method( app, elem, fabfile_path, install_dir, package_name=None, **kwd ): +def run_proprietary_fabric_method( app, elem, proprietary_fabfile_path, install_dir, package_name=None, **kwd ): """ TODO: Handle this using the fabric api. Parse a tool_dependency.xml file's fabfile <method> tag set to build the method parameters and execute the method. @@ -190,10 +182,10 @@ else: params_str = params_str.rstrip( ',' ) try: - cmd = 'fab -f %s %s:%s' % ( fabfile_path, method_name, params_str ) + cmd = 'fab -f %s %s:%s' % ( proprietary_fabfile_path, method_name, params_str ) returncode, message = run_subprocess( app, cmd ) except Exception, e: - return "Exception executing fabric script %s: %s. " % ( str( fabfile_path ), str( e ) ) + return "Exception executing fabric script %s: %s. " % ( str( proprietary_fabfile_path ), str( e ) ) if returncode: return message message = handle_post_build_processing( app, tool_dependency, install_dir, env_dependency_path, package_name=package_name ) diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -479,52 +479,16 @@ package_name = elem.get( 'name', None ) package_version = elem.get( 'version', None ) if package_name and package_version: + dependency_key = '%s/%s' % ( package_name, package_version ) requirements_dict [ 'name' ] = package_name + requirements_dict [ 'version' ] = package_version requirements_dict [ 'type' ] = 'package' - requirements_dict [ 'version' ] = package_version - dependency_key = '%s/%s' % ( package_name, package_version ) - fabfiles_dict = {} for sub_elem in elem: - if sub_elem.tag == 'proprietary_fabfile': - requirements_dict = generate_fabfile_metadata( sub_elem, requirements_dict, proprietary=True ) - elif sub_elem.tag == 'fabfile': - requirements_dict = generate_fabfile_metadata( sub_elem, requirements_dict, proprietary=False ) - elif sub_elem.tag == 'readme': + if sub_elem.tag == 'readme': requirements_dict[ 'readme' ] = sub_elem.text if requirements_dict: tool_dependencies_dict[ dependency_key ] = requirements_dict return tool_dependencies_dict -def generate_fabfile_metadata( elem, requirements_dict, proprietary=False ): - """ - <proprietary_fabfile name="fabfile.py"> - <method name="install_and_build"> - <param name="download_url">ftp://emboss.open-bio.org/pub/EMBOSS/old/5.0.0/EMBOSS-5.0.0.tar.gz</param> - <param name="download_url">ftp://emboss.open-bio.org/pub/EMBOSS/old/5.0.0/PHYLIP-3.6b.tar.gz</param> - </method> - </proprietary_fabfile> - """ - fabfiles_dict = {} - fabfile_name = elem.get( 'name', None ) - if fabfile_name: - for method_elem in elem.findall( 'method' ): - method_name = method_elem.get( 'name', None ) - if method_name: - params_str = '' - for param_elem in method_elem.findall( 'param' ): - param_name = param_elem.get( 'name', None ) - param_value = param_elem.text - if param_name and param_value: - params_str += '%s=%s,' % ( param_name, param_value ) - fabfiles_dict[ 'fabfile' ] = fabfile_name - fabfiles_dict[ 'method' ] = method_name - fabfiles_dict[ 'params' ] = params_str.rstrip( ',' ) - if fabfiles_dict: - if proprietary: - key = 'proprietary_fabfiles' - else: - key = 'fabfiles' - requirements_dict[ key ] = fabfiles_dict - return requirements_dict def generate_metadata_using_disk_files( toolbox, relative_install_dir, repository_clone_url ): """Generate metadata using only the repository files on disk - files are not retrieved from the repository manifest.""" metadata_dict = {} @@ -1194,7 +1158,7 @@ message = str( e ) error = True return error, message -def handle_tool_dependencies( app, tool_shed_repository, tool_dependencies_config, tool_dependencies=None ): +def handle_tool_dependencies( app, tool_shed_repository, tool_dependencies_config, tool_dependencies ): """ Install and build tool dependencies defined in the tool_dependencies_config. This config's tag sets can currently refer to installation methods in Galaxy's tool_dependencies module. In the future, proprietary fabric scripts contained in the repository will be supported. @@ -1202,8 +1166,7 @@ will be installed in: ~/<app.config.tool_dependency_dir>/<package_name>/<package_version>/<repo_owner>/<repo_name>/<repo_installed_changeset_revision> """ - status = 'done' - message = '' + installed_tool_dependencies = [] # Parse the tool_dependencies.xml config. tree = ElementTree.parse( tool_dependencies_config ) root = tree.getroot() @@ -1214,7 +1177,8 @@ package_name = elem.get( 'name', None ) package_version = elem.get( 'version', None ) if package_name and package_version: - can_install = True + # The value of tool_dependencies will be None only when this method is called by the InstallManager. In that case, tool + # dependency installation is not ajaxian, so the ToolDependency objects do not yet exist. if tool_dependencies: # Only install the package if it is not already installed. can_install = False @@ -1223,12 +1187,14 @@ can_install = tool_dependency.status in [ app.model.ToolDependency.installation_status.NEVER_INSTALLED, app.model.ToolDependency.installation_status.UNINSTALLED ] break + else: + can_install = False if can_install: tool_dependency = install_package( app, elem, tool_shed_repository, tool_dependencies=tool_dependencies ) - if tool_dependency and tool_dependency.status == app.model.ToolDependency.installation_status.ERROR: - message = tool_dependency.error_message - status = 'error' - return status, message + if tool_dependency and tool_dependency.status in [ app.model.ToolDependency.installation_status.INSTALLED, + app.model.ToolDependency.installation_status.ERROR ]: + installed_tool_dependencies.append( tool_dependency ) + return installed_tool_dependencies def handle_tool_versions( app, tool_version_dicts, tool_shed_repository ): """ Using the list of tool_version_dicts retrieved from the tool shed (one per changeset revison up to the currently installed changeset revision), diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -113,6 +113,11 @@ use_paging = False columns = [ NameColumn( "Name", + link=( lambda item: iff( item.status in \ + [ model.ToolDependency.installation_status.NEVER_INSTALLED, + model.ToolDependency.installation_status.INSTALLING, + model.ToolDependency.installation_status.UNINSTALLED ], \ + None, dict( action="manage_tool_dependencies", operation='browse', id=item.id ) ) ), filterable="advanced" ), VersionColumn( "Version", filterable="advanced" ), @@ -130,8 +135,17 @@ allow_multiple=True, allow_popup=False, condition=( lambda item: item.status in [ model.ToolDependency.installation_status.INSTALLED, - model.ToolDependency.installation_status.ERROR ] ) ) + model.ToolDependency.installation_status.ERROR ] ) ) ] + def build_initial_query( self, trans, **kwd ): + tool_dependency_ids = kwd.get( 'tool_dependency_ids', None ) + if tool_dependency_ids: + clause_list = [] + for tool_dependency_id in tool_dependency_ids: + clause_list.append( self.model_class.table.c.id == trans.security.decode_id( tool_dependency_id ) ) + return trans.sa_session.query( self.model_class ) \ + .filter( or_( *clause_list ) ) + return trans.sa_session.query( self.model_class ) def apply_query_filter( self, trans, query, **kwd ): tool_dependency_id = kwd.get( 'tool_dependency_id', None ) if not tool_dependency_id: @@ -363,6 +377,7 @@ def initiate_tool_dependency_installation( self, trans, tool_dependencies ): """Install specified dependencies for repository tools.""" # Get the tool_shed_repository from one of the tool_dependencies. + message = '' tool_shed_repository = tool_dependencies[ 0 ].tool_shed_repository work_dir = make_tmp_directory() # Get the tool_dependencies.xml file from the repository. @@ -371,17 +386,23 @@ tool_shed_repository, tool_shed_repository.changeset_revision, work_dir ) - status, message = handle_tool_dependencies( app=trans.app, - tool_shed_repository=tool_shed_repository, - tool_dependencies_config=tool_dependencies_config, - tool_dependencies=tool_dependencies ) + installed_tool_dependencies = handle_tool_dependencies( app=trans.app, + tool_shed_repository=tool_shed_repository, + tool_dependencies_config=tool_dependencies_config, + tool_dependencies=tool_dependencies ) + for installed_tool_dependency in installed_tool_dependencies: + if installed_tool_dependency.status == trans.app.model.ToolDependency.installation_status.ERROR: + message += ' %s' % installed_tool_dependency.error_message try: shutil.rmtree( work_dir ) except: pass tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_dependencies ] - if not message: - message = "Installed tool dependencies: %s" % ','.join( td.name for td in tool_dependencies ) + if message: + status = 'error' + else: + message = "Installed tool dependencies: %s" % ','.join( td.name for td in installed_tool_dependencies ) + status = 'done' return trans.response.send_redirect( web.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=tool_dependency_ids, diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f templates/admin/tool_shed_repository/manage_repository.mako --- a/templates/admin/tool_shed_repository/manage_repository.mako +++ b/templates/admin/tool_shed_repository/manage_repository.mako @@ -88,6 +88,7 @@ <td><b>name</b></td><td><b>version</b></td><td><b>type</b></td> + <td><b>status</b></td></tr> %for tool_dependency in missing_tool_dependencies: <tr> @@ -98,6 +99,7 @@ </td><td>${tool_dependency.version}</td><td>${tool_dependency.type}</td> + <td>${tool_dependency.status}</td></tr> %endfor </table> diff -r d2aba0918cf01b1c5be95f7b0b59cc52cd889dbd -r 20e01e610de056e2f2855df9a3840c315b17587f templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -111,13 +111,14 @@ %for dependency_key, requirements_dict in tool_dependencies.items(): <% name = requirements_dict[ 'name' ] + version = requirements_dict[ 'version' ] type = requirements_dict[ 'type' ] - version = requirements_dict[ 'version' ] + %><tr><td>${name}</td> + <td>${version}</td><td>${type}</td> - <td>${version}</td></tr> %endfor </table> 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.