1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ab9f5cb3acd8/ Changeset: ab9f5cb3acd8 User: greg Date: 2013-10-10 20:11:09 Summary: Filter tool dependency installation to only those that were checked when installing them from the Manage tool dependencies page for an installed tool shed repository. Affected #: 3 files diff -r 450c04224d6cd0f2c8c7964cedcd0eeafd98c873 -r ab9f5cb3acd8dcfe30fc5b92fc4a792c9815c877 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -701,11 +701,11 @@ installed_tool_dependencies_select_field = suc.build_tool_dependencies_select_field( trans, tool_shed_repository=tool_shed_repository, name='inst_td_ids', - uninstalled=False ) + uninstalled_only=False ) uninstalled_tool_dependencies_select_field = suc.build_tool_dependencies_select_field( trans, tool_shed_repository=tool_shed_repository, name='uninstalled_tool_dependency_ids', - uninstalled=True ) + uninstalled_only=True ) return trans.fill_template( '/admin/tool_shed_repository/manage_repository_tool_dependencies.mako', repository=tool_shed_repository, installed_tool_dependencies_select_field=installed_tool_dependencies_select_field, diff -r 450c04224d6cd0f2c8c7964cedcd0eeafd98c873 -r ab9f5cb3acd8dcfe30fc5b92fc4a792c9815c877 lib/tool_shed/util/common_install_util.py --- a/lib/tool_shed/util/common_install_util.py +++ b/lib/tool_shed/util/common_install_util.py @@ -429,6 +429,10 @@ will be installed in: ~/<app.config.tool_dependency_dir>/<package_name>/<package_version>/<repo_owner>/<repo_name>/<repo_installed_changeset_revision> """ + # The received list of tool_dependencies are the database records for those dependencies defined in the received tool_dependencies_config + # that should be installed. This allows for filtering out dependencies that have not been checked for installation on the 'Manage tool + # dependencies' page for an installed tool shed repository. + attr_tups_of_dependencies_for_install = [ ( td.name, td.version, td.type ) for td in tool_dependencies ] sa_session = app.model.context.current installed_tool_dependencies = [] # Parse the tool_dependencies.xml config. @@ -439,19 +443,43 @@ fabric_version_checked = False for elem in root: if elem.tag == 'package': - # Only install the tool_dependency if it is not already installed. + # Only install the tool_dependency if it is not already installed and it is associated with a database record in the received + # tool_dependencies. package_name = elem.get( 'name', None ) package_version = elem.get( 'version', None ) if package_name and package_version: - for tool_dependency in tool_dependencies: - if tool_dependency.name==package_name and tool_dependency.version==package_version: - break - if tool_dependency.can_install: + attr_tup = ( package_name, package_version, 'package' ) + try: + index = attr_tups_of_dependencies_for_install.index( attr_tup ) + except Exception, e: + index = None + if index is not None: + tool_dependency = tool_dependencies[ index ] + if tool_dependency.can_install: + try: + tool_dependency = install_package( app, elem, tool_shed_repository, tool_dependencies=tool_dependencies ) + except Exception, e: + error_message = "Error installing tool dependency %s version %s: %s" % ( str( package_name ), str( package_version ), str( e ) ) + log.exception( error_message ) + if tool_dependency: + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = error_message + sa_session.add( tool_dependency ) + sa_session.flush() + 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 ) + elif elem.tag == 'set_environment': + env_var_name = env_var_elem.get( 'name', None ) + if env_var_name: + # Tool dependencies of type "set_environmnet" always have the version attribute set to None. + attr_tup = ( env_var_name, None, 'set_environment' ) + if attr_tup in attr_tups_of_dependencies_for_install: try: - tool_dependency = install_package( app, elem, tool_shed_repository, tool_dependencies=tool_dependencies ) + tool_dependency = set_environment( app, elem, tool_shed_repository ) except Exception, e: - error_message = "Error installing tool dependency %s version %s: %s" % ( str( package_name ), str( package_version ), str( e ) ) - log.exception( error_message ) + error_message = "Error setting environment for tool dependency: %s" % str( e ) + log.debug( error_message ) if tool_dependency: tool_dependency.status = app.model.ToolDependency.installation_status.ERROR tool_dependency.error_message = error_message @@ -460,20 +488,6 @@ 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 ) - elif elem.tag == 'set_environment': - try: - tool_dependency = set_environment( app, elem, tool_shed_repository ) - except Exception, e: - error_message = "Error setting environment for tool dependency: %s" % str( e ) - log.debug( error_message ) - if tool_dependency: - tool_dependency.status = app.model.ToolDependency.installation_status.ERROR - tool_dependency.error_message = error_message - sa_session.add( tool_dependency ) - sa_session.flush() - 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 repository_dependency_needed_only_for_compiling_tool_dependency( repository, repository_dependency ): diff -r 450c04224d6cd0f2c8c7964cedcd0eeafd98c873 -r ab9f5cb3acd8dcfe30fc5b92fc4a792c9815c877 lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -144,13 +144,18 @@ repositories_select_field.add_option( option_label, option_value ) return repositories_select_field -def build_tool_dependencies_select_field( trans, tool_shed_repository, name, multiple=True, display='checkboxes', uninstalled=False ): +def build_tool_dependencies_select_field( trans, tool_shed_repository, name, multiple=True, display='checkboxes', uninstalled_only=False ): """Method called from Galaxy to generate the current list of tool dependency ids for an installed tool shed repository.""" tool_dependencies_select_field = SelectField( name=name, multiple=multiple, display=display ) for tool_dependency in tool_shed_repository.tool_dependencies: - if uninstalled and tool_dependency.status not in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED, - trans.model.ToolDependency.installation_status.UNINSTALLED ]: - continue + if uninstalled_only: + if tool_dependency.status not in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED, + trans.model.ToolDependency.installation_status.UNINSTALLED ]: + continue + else: + if tool_dependency.status in [ trans.model.ToolDependency.installation_status.NEVER_INSTALLED, + trans.model.ToolDependency.installation_status.UNINSTALLED ]: + continue option_label = '%s version %s' % ( str( tool_dependency.name ), str( tool_dependency.version ) ) option_value = trans.security.encode_id( tool_dependency.id ) tool_dependencies_select_field.add_option( option_label, option_value ) 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.