commit/galaxy-central: greg: Handle deactivated repository dependencies when installing or reinstalling a tool shed repository.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/bcb446fd0248/ changeset: bcb446fd0248 user: greg date: 2013-01-10 00:08:51 summary: Handle deactivated repository dependencies when installing or reinstalling a tool shed repository. affected #: 2 files diff -r a91d8ea3c9e2e9d6cc8cfd85c7085bf1175b4f5c -r bcb446fd02481aaba2bbe72d8298d93ff6698c99 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -23,6 +23,38 @@ log = logging.getLogger( __name__ ) +def activate_repository( trans, repository ): + repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, repository ) + shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) + repository.deleted = False + repository.status = trans.model.ToolShedRepository.installation_status.INSTALLED + if repository.includes_tools: + metadata = repository.metadata + repository_tools_tups = suc.get_repository_tools_tups( trans.app, metadata ) + # Reload tools into the appropriate tool panel section. + tool_panel_dict = repository.metadata[ 'tool_panel_section' ] + add_to_tool_panel( trans.app, + repository.name, + repository_clone_url, + repository.installed_changeset_revision, + repository_tools_tups, + repository.owner, + shed_tool_conf, + tool_panel_dict, + new_install=False ) + trans.sa_session.add( repository ) + trans.sa_session.flush() + if repository.includes_datatypes: + if tool_path: + repository_install_dir = os.path.abspath ( os.path.join( tool_path, relative_install_dir ) ) + else: + repository_install_dir = os.path.abspath ( relative_install_dir ) + # Activate proprietary datatypes. + installed_repository_dict = load_installed_datatypes( trans.app, repository, repository_install_dir, deactivate=False ) + if installed_repository_dict and 'converter_path' in installed_repository_dict: + load_installed_datatype_converters( trans.app, installed_repository_dict, deactivate=False ) + if installed_repository_dict and 'display_path' in installed_repository_dict: + load_installed_display_applications( trans.app, installed_repository_dict, deactivate=False ) def add_to_shed_tool_config( app, shed_tool_conf_dict, elem_list ): # A tool shed repository is being installed so change the shed_tool_conf file. Parse the config file to generate the entire list # of config_elems instead of using the in-memory list since it will be a subset of the entire list if one or more repositories have @@ -227,6 +259,10 @@ installed_changeset_revision = installed_tool_shed_repository.installed_changeset_revision metadata_dict = installed_tool_shed_repository.metadata dist_to_shed = installed_tool_shed_repository.dist_to_shed + elif installed_tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]: + # The current tool shed repository is deactivated, so updating it's database record is not necessary - just activate it. + activate_repository( trans, installed_tool_shed_repository ) + can_update = False else: # The tool shed repository currently being processed is already installed or is in the process of being installed, so it's record # in the database cannot be updated. diff -r a91d8ea3c9e2e9d6cc8cfd85c7085bf1175b4f5c -r bcb446fd02481aaba2bbe72d8298d93ff6698c99 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 @@ -321,43 +321,19 @@ """Activate a repository that was deactivated but not uninstalled.""" repository_id = kwd[ 'id' ] repository = suc.get_installed_tool_shed_repository( trans, repository_id ) - shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) - repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, repository ) - repository.deleted = False - repository.status = trans.model.ToolShedRepository.installation_status.INSTALLED - if repository.includes_tools: - metadata = repository.metadata - try: - repository_tools_tups = suc.get_repository_tools_tups( trans.app, metadata ) - except Exception, e: - error = "Error activating repository %s: %s" % ( repository.name, str( e ) ) - log.debug( error ) - return trans.show_error_message( '%s.<br/>You may be able to resolve this by uninstalling and then reinstalling the repository. Click <a href="%s">here</a> to uninstall the repository.' - % ( error, web.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) ) ) ) - # Reload tools into the appropriate tool panel section. - tool_panel_dict = repository.metadata[ 'tool_panel_section' ] - shed_util.add_to_tool_panel( trans.app, - repository.name, - repository_clone_url, - repository.installed_changeset_revision, - repository_tools_tups, - repository.owner, - shed_tool_conf, - tool_panel_dict, - new_install=False ) - trans.sa_session.add( repository ) - trans.sa_session.flush() - if repository.includes_datatypes: - if tool_path: - repository_install_dir = os.path.abspath ( os.path.join( tool_path, relative_install_dir ) ) - else: - repository_install_dir = os.path.abspath ( relative_install_dir ) - # Activate proprietary datatypes. - installed_repository_dict = shed_util.load_installed_datatypes( trans.app, repository, repository_install_dir, deactivate=False ) - if installed_repository_dict and 'converter_path' in installed_repository_dict: - shed_util.load_installed_datatype_converters( trans.app, installed_repository_dict, deactivate=False ) - if installed_repository_dict and 'display_path' in installed_repository_dict: - shed_util.load_installed_display_applications( trans.app, installed_repository_dict, deactivate=False ) + try: + shed_util.activate_repository( trans, repository ) + except Exception, e: + error_message = "Error activating repository %s: %s" % ( repository.name, str( e ) ) + log.debug( error_message ) + message = '%s.<br/>You may be able to resolve this by uninstalling and then reinstalling the repository. Click <a href="%s">here</a> to uninstall the repository.' \ + % ( error_message, web.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) ) ) + status = 'error' + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='manage_repository', + id=repository_id, + message=message, + status=status ) ) message = 'The <b>%s</b> repository has been activated.' % repository.name status = 'done' return trans.response.send_redirect( web.url_for( controller='admin_toolshed', 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.
participants (1)
-
Bitbucket