More fixes for handling mor ethan one non-shed tool anel config when installing tools migrated from the distrobution to the tool shed.

This commit is contained in:
Greg Von Kuster
2012-03-15 14:12:59 -04:00
parent 18584b5d3f
commit 7ebdf0f24a
4 changed files with 23 additions and 16 deletions
+1 -2
View File
@@ -18,8 +18,7 @@ class InstallManager( object ):
self.app = app
self.toolbox = self.app.toolbox
self.migrated_tools_config = migrated_tools_config
# Get the local non-shed related tool panel config (the default name is tool_conf.xml). If the user has more than 1
# non-shed tool panel config it could cause problems.
# Get the local non-shed related tool panel configs (there can be more than one, and the default name is tool_conf.xml).
self.proprietary_tool_confs = self.non_shed_tool_panel_configs
self.proprietary_tool_panel_elems = self.get_proprietary_tool_panel_elems( latest_migration_script_number )
# Set the location where the repositories will be installed by retrieving the tool_path setting from migrated_tools_config.
+12 -6
View File
@@ -46,11 +46,11 @@ def verify_tools( app, url, galaxy_config_file, engine_options={} ):
# New installations will not be missing tools, so we don't need to worry about them.
missing_tool_configs = []
else:
tool_panel_config = get_non_shed_tool_panel_config( app )
if tool_panel_config is None:
missing_tool_configs = []
tool_panel_configs = get_non_shed_tool_panel_configs( app )
if tool_panel_configs:
missing_tool_configs = check_for_missing_tools( tool_panel_configs, latest_tool_migration_script_number )
else:
missing_tool_configs = check_for_missing_tools( tool_panel_config, latest_tool_migration_script_number )
missing_tool_configs = []
config_arg = ''
if os.path.abspath( os.path.join( os.getcwd(), 'universe_wsgi.ini' ) ) != galaxy_config_file:
config_arg = ' -c %s' % galaxy_config_file.replace( os.path.abspath( os.getcwd() ), '.' )
@@ -62,13 +62,19 @@ def verify_tools( app, url, galaxy_config_file, engine_options={} ):
if return_code != 0:
raise Exception( "Error attempting to update the value of migrate_tools.version: %s" % output )
elif missing_tool_configs:
if len( tool_panel_configs ) == 1:
plural = ''
tool_panel_config_file_names = tool_panel_configs[ 0 ]
else:
plural = 's'
tool_panel_config_file_names = ', '.join( tool_panel_configs )
msg = "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
msg += "\n\nThe list of files at the end of this message refers to tools that are configured to load into the tool panel for\n"
msg += "this Galaxy instance, but have been removed from the Galaxy distribution. These tools can be automatically installed\n"
msg += "from the Galaxy tool shed at http://toolshed.g2.bx.psu.edu.\n\n"
msg += "To skip this process, attempt to start your Galaxy server again (e.g., sh run.sh or whatever you use). If you do this,\n"
msg += "be aware that these tools will no longer be available in your Galaxy tool panel, and entries for each of them should\n"
msg += "be removed from your file named %s.\n\n" % tool_panel_config
msg += "be removed from your file%s named %s.\n\n" % ( plural, tool_panel_config_file_names )
msg += "CRITICAL NOTE IF YOU PLAN TO INSTALL\n"
msg += "The location in which the tool repositories will be installed is the value of the 'tool_path' attribute in the <tool>\n"
msg += 'tag of the file named ./migrated_tool_conf.xml (i.e., <toolbox tool_path="../shed_tools">). The default location\n'
@@ -84,7 +90,7 @@ def verify_tools( app, url, galaxy_config_file, engine_options={} ):
msg += "After the installation process finishes, you can start your Galaxy server. As part of this installation process,\n"
msg += "entries for each of the following tool config files will be added to the file named ./migrated_tool_conf.xml, so these\n"
msg += "tools will continue to be loaded into your tool panel. Because of this, existing entries for these files should be\n"
msg += "removed from your file named %s, but only after the installation process finishes.\n\n" % tool_panel_config
msg += "removed from your file%s named %s, but only after the installation process finishes.\n\n" % ( plural, tool_panel_config_file_names )
for i, missing_tool_config in enumerate( missing_tool_configs ):
msg += "%s\n" % missing_tool_config
# Should we do the following?
+5 -5
View File
@@ -39,8 +39,9 @@ def check_tool_tag_set( elem, migrated_tool_configs, missing_tool_configs ):
if name in migrated_tool_configs:
missing_tool_configs.append( name )
return missing_tool_configs
def get_non_shed_tool_panel_config( app ):
# Get the non-shed related tool panel config value from the Galaxy config - the default is tool_conf.xml.
def get_non_shed_tool_panel_configs( app ):
# Get the non-shed related tool panel configs - there can be more than one, and the default is tool_conf.xml.
config_filenames = []
for config_filename in app.config.tool_configs:
# Any config file that includes a tool_path attribute in the root tag set like the following is shed-related.
# <toolbox tool_path="../shed_tools">
@@ -48,9 +49,8 @@ def get_non_shed_tool_panel_config( app ):
root = tree.getroot()
tool_path = root.get( 'tool_path', None )
if tool_path is None:
# There will be a problem here if the user has defined 2 non-shed related configs.
return config_filename
return None
config_filenames.append( config_filename )
return config_filenames
class MigrateToolsApplication( object ):
"""Encapsulates the state of a basic Galaxy Universe application in order to initiate the Install Manager"""
def __init__( self, tools_migration_config ):
+5 -3
View File
@@ -20,12 +20,14 @@ from galaxy.tool_shed.migrate.common import *
app = MigrateToolsApplication( sys.argv[ 1 ] )
non_shed_tool_confs = app.install_manager.proprietary_tool_confs
msg = "\nThe installation process is finished. You should now remove entries for the installed tools from "
if len( non_shed_tool_confs ) == 1:
msg += "your file named %s and start your Galaxy server." % non_shed_tool_conf
plural = ''
file_names = non_shed_tool_confs[ 0 ]
else:
plural = 's'
file_names = ', '.join( non_shed_tool_confs )
msg += "your files named %s, and start your Galaxy server." % file_names
msg = "\nThe installation process is finished. You should now remove entries for the installed tools from your file%s named\n" % plural
msg += "%s and start your Galaxy server.\n" % file_names
print msg
app.shutdown()
sys.exit( 0 )