commit/galaxy-central: greg: Add the ability to browse, uninstall and reinstall tool dependencies installed with tool shed repositories.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/7c495f835a1d/ changeset: 7c495f835a1d user: greg date: 2012-06-18 18:15:04 summary: Add the ability to browse, uninstall and reinstall tool dependencies installed with tool shed repositories. affected #: 19 files diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2701,13 +2701,8 @@ return installed_dependencies @property def missing_tool_dependencies( self ): - """Return the repository's tool dependencies that are not currently installed.""" - def add_missing_dependency( missing_dependencies_dict, name, version, type, installed_changeset_revision=None ): - missing_dependencies_dict[ name ] = dict( version=version, - type=type, - installed_changeset_revision=installed_changeset_revision ) - return missing_dependencies_dict - missing_dependencies = {} + """Return the repository's tool dependencies that are not currently installed, and may not ever have been installed.""" + missing_dependencies = [] # Get the dependency information from the metadata for comparison against the installed tool dependencies. tool_dependencies = self.metadata.get( 'tool_dependencies', None ) if tool_dependencies: @@ -2717,25 +2712,27 @@ type = requirements_dict[ 'type' ] if self.tool_dependencies: found = False - for installed_dependency in self.tool_dependencies: - if installed_dependency.name==name and installed_dependency.version==version and installed_dependency.type==type: + for tool_dependency in self.tool_dependencies: + if tool_dependency.name==name and tool_dependency.version==version and tool_dependency.type==type: found = True - if installed_dependency.uninstalled: - missing_dependencies = add_missing_dependency( missing_dependencies, - installed_dependency.name, - installed_dependency.version, - installed_dependency.type, - installed_dependency.installed_changeset_revision ) + if tool_dependency.uninstalled: + missing_dependencies.append( ( tool_dependency.name, tool_dependency.version, tool_dependency.type ) ) break if not found: - missing_dependencies = add_missing_dependency( missing_dependencies, name, version, type ) - return missing_dependencies - return None + missing_dependencies.append( ( name, version, type ) ) + return missing_dependencies + @property + def uninstalled_tool_dependencies( self ): + """Return the repository's tool dependencies that have been uninstalled.""" + uninstalled_tool_dependencies = [] + for tool_dependency in self.tool_dependencies: + if tool_dependency.uninstalled: + uninstalled_tool_dependencies.append( tool_dependency ) + return uninstalled_tool_dependencies class ToolDependency( object ): - def __init__( self, tool_shed_repository_id=None, installed_changeset_revision=None, name=None, version=None, type=None, uninstalled=False ): + def __init__( self, tool_shed_repository_id=None, name=None, version=None, type=None, uninstalled=False ): self.tool_shed_repository_id = tool_shed_repository_id - self.installed_changeset_revision = installed_changeset_revision self.name = name self.version = version self.type = type @@ -2746,7 +2743,8 @@ self.version, self.tool_shed_repository.owner, self.tool_shed_repository.name, - self.installed_changeset_revision ) + self.tool_shed_repository.installed_changeset_revision ) + class ToolVersion( object ): def __init__( self, id=None, create_time=None, tool_id=None, tool_shed_repository=None ): self.id = id diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -395,7 +395,6 @@ Column( "create_time", DateTime, default=now ), Column( "update_time", DateTime, default=now, onupdate=now ), Column( "tool_shed_repository_id", Integer, ForeignKey( "tool_shed_repository.id" ), index=True, nullable=False ), - Column( "installed_changeset_revision", TrimmedString( 255 ) ), Column( "name", TrimmedString( 255 ) ), Column( "version", Text ), Column( "type", TrimmedString( 40 ) ), @@ -1681,6 +1680,7 @@ backref='tool_shed_repository' ), tool_dependencies=relation( ToolDependency, primaryjoin=( ToolShedRepository.table.c.id == ToolDependency.table.c.tool_shed_repository_id ), + order_by=ToolDependency.table.c.name, backref='tool_shed_repository' ) ) ) assign_mapper( context, ToolDependency, ToolDependency.table ) diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py --- /dev/null +++ b/lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py @@ -0,0 +1,39 @@ +""" +Migration script to drop the installed_changeset_revision column from the tool_dependency table. +""" +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * +import sys, logging +from galaxy.model.custom_types import * +from sqlalchemy.exc import * +import datetime +now = datetime.datetime.utcnow + +log = logging.getLogger( __name__ ) +log.setLevel( logging.DEBUG ) +handler = logging.StreamHandler( sys.stdout ) +format = "%(name)s %(levelname)s %(asctime)s %(message)s" +formatter = logging.Formatter( format ) +handler.setFormatter( formatter ) +log.addHandler( handler ) + +metadata = MetaData( migrate_engine ) + +def upgrade(): + print __doc__ + metadata.reflect() + try: + ToolDependency_table = Table( "tool_dependency", metadata, autoload=True ) + except NoSuchTableError: + ToolDependency_table = None + log.debug( "Failed loading table tool_dependency" ) + if ToolDependency_table: + try: + col = ToolDependency_table.c.installed_changeset_revision + col.drop() + except Exception, e: + log.debug( "Dropping column 'installed_changeset_revision' from tool_dependency table failed: %s" % ( str( e ) ) ) +def downgrade(): + pass diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/tool_shed/install_manager.py --- a/lib/galaxy/tool_shed/install_manager.py +++ b/lib/galaxy/tool_shed/install_manager.py @@ -120,8 +120,8 @@ if not is_displayed: is_displayed = True return is_displayed, tool_sections - def handle_repository_contents( self, repository_clone_url, relative_install_dir, repository_elem, repository_name, description, installed_changeset_revision, - ctx_rev, install_dependencies ): + def handle_repository_contents( self, repository_clone_url, relative_install_dir, repository_elem, repository_name, description, + installed_changeset_revision, ctx_rev, install_dependencies ): # Generate the metadata for the installed tool shed repository, among other things. It is critical that the installed repository is # updated to the desired changeset_revision before metadata is set because the process for setting metadata uses the repository files on disk. # The values for the keys in each of the following dictionaries will be a list to allow for the same tool to be displayed in multiple places @@ -176,7 +176,6 @@ # Install tool dependencies. status, message = handle_tool_dependencies( app=self.app, tool_shed_repository=tool_shed_repository, - installed_changeset_revision=installed_changeset_revision, tool_dependencies_config=tool_dependencies_config ) if status != 'ok' and message: print 'The following error occurred from the InstallManager while installing tool dependencies:' diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/tool_shed/migrate/common.py --- a/lib/galaxy/tool_shed/migrate/common.py +++ b/lib/galaxy/tool_shed/migrate/common.py @@ -48,7 +48,6 @@ tree = util.parse_xml( tool_panel_config ) root = tree.getroot() for elem in root: - missing_tool_dependencies = [] if elem.tag == 'tool': missing_tool_configs_dict = check_tool_tag_set( elem, migrated_tool_configs_dict, missing_tool_configs_dict ) elif elem.tag == 'section': @@ -116,6 +115,8 @@ self.datatypes_registry = galaxy.datatypes.registry.Registry() # Load the data types in the Galaxy distribution, which are defined in self.config.datatypes_config. self.datatypes_registry.load_datatypes( self.config.root, self.config.datatypes_config ) + # Tool data tables + self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_path, self.config.tool_data_table_config_path ) # Initialize the tools, making sure the list of tool configs includes the reserved migrated_tools_conf.xml file. tool_configs = self.config.tool_configs if self.config.migrated_tools_config not in tool_configs: diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/tool_shed/tool_dependencies/common_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/common_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/common_util.py @@ -1,9 +1,9 @@ import os, shutil, tarfile, urllib2 from galaxy.datatypes.checkers import * -DIRECTORY_BUILD_COMMAND_NAMES = [ 'change_directory' ] -MOVE_BUILD_COMMAND_NAMES = [ 'move_directory_files', 'move_file' ] -ALL_BUILD_COMMAND_NAMES = DIRECTORY_BUILD_COMMAND_NAMES + MOVE_BUILD_COMMAND_NAMES +MISCELLANEOUS_ACTIONS = [ 'change_directory' ] +MOVE_ACTIONS = [ 'move_directory_files', 'move_file' ] +ALL_ACTIONS = MISCELLANEOUS_ACTIONS + MOVE_ACTIONS def extract_tar( file_name, file_path ): if isgzip( file_name ) or isbz2( file_name ): diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 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 @@ -32,32 +32,20 @@ yield work_dir if os.path.exists( work_dir ): local( 'rm -rf %s' % work_dir ) -def handle_post_build_processing( tool_dependency_dir, install_dir, package_name=None ): - cmd = "echo 'PATH=%s/bin:$PATH; export PATH' > %s/env.sh;chmod +x %s/env.sh" % ( install_dir, install_dir, install_dir ) +def handle_post_build_processing( tool_dependency_dir, install_dir, env_dependency_path, package_name=None ): + cmd = "echo 'PATH=%s:$PATH; export PATH' > %s/env.sh;chmod +x %s/env.sh" % ( env_dependency_path, install_dir, install_dir ) message = '' output = local( cmd, capture=True ) log_results( cmd, output, os.path.join( install_dir, 'env_sh.log' ) ) if output.return_code: message = '%s %s' % ( message, str( output.stderr ) ) - """ - Since automatic dependency installation requires a version attribute in the tool's <requirement> tag, we don't have to - create a default symlink, but we'll keep this code around for a bit just in case we need it later. - if package_name: - package_dir = os.path.join( tool_dependency_dir, package_name ) - package_default = os.path.join( package_dir, 'default' ) - if not os.path.islink( package_default ): - cmd = 'ln -s %s %s' % ( install_dir, package_default ) - output = local( cmd, capture=True ) - if output.return_code: - message = '%s\n%s' % ( message, str( output.stderr ) ) - """ return message def install_and_build_package( params_dict ): """Install a Galaxy tool dependency package either via a url or a mercurial or git clone command.""" install_dir = params_dict[ 'install_dir' ] download_url = params_dict.get( 'download_url', None ) clone_cmd = params_dict.get( 'clone_cmd', None ) - build_commands = params_dict.get( 'build_commands', 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 ): @@ -75,36 +63,36 @@ if output.return_code: return '%s. ' % str( output.stderr ) dir = package_name - if build_commands: + if actions: with lcd( dir ): current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) - for build_command_tup in build_commands: - build_command_key, build_command_dict = build_command_tup - if build_command_key.find( 'v^v^v' ) >= 0: - build_command_items = build_command_key.split( 'v^v^v' ) - build_command_name = build_command_items[ 0 ] - build_command = build_command_items[ 1 ] - elif build_command_key in common_util.ALL_BUILD_COMMAND_NAMES: - build_command_name = build_command_key + for action_tup in actions: + action_key, action_dict = action_tup + if action_key.find( 'v^v^v' ) >= 0: + action_items = action_key.split( 'v^v^v' ) + action_name = action_items[ 0 ] + action = action_items[ 1 ] + elif action_key in common_util.ALL_ACTIONS: + action_name = action_key else: - build_command_name = None - if build_command_name: - if build_command_name == 'change_directory': - current_dir = os.path.join( current_dir, build_command ) + action_name = None + if action_name: + if action_name == 'change_directory': + current_dir = os.path.join( current_dir, action ) lcd( current_dir ) - elif build_command_name == 'move_directory_files': + elif action_name == 'move_directory_files': common_util.move_directory_files( current_dir=current_dir, - source_dir=os.path.join( build_command_dict[ 'source_directory' ] ), - destination_dir=os.path.join( build_command_dict[ 'destination_directory' ] ) ) - elif build_command_name == 'move_file': + source_dir=os.path.join( action_dict[ 'source_directory' ] ), + destination_dir=os.path.join( action_dict[ 'destination_directory' ] ) ) + elif action_name == 'move_file': common_util.move_file( current_dir=current_dir, - source=os.path.join( build_command_dict[ 'source' ] ), - destination_dir=os.path.join( build_command_dict[ 'destination' ] ) ) + source=os.path.join( action_dict[ 'source' ] ), + destination_dir=os.path.join( action_dict[ 'destination' ] ) ) else: - build_command = build_command_key + action = action_key with settings( warn_only=True ): - output = local( build_command, capture=True ) - log_results( build_command, output, os.path.join( install_dir, 'build_commands.log' ) ) + output = local( action, capture=True ) + log_results( action, output, os.path.join( install_dir, 'actions.log' ) ) if output.return_code: return '%s. ' % str( output.stderr ) return '' @@ -119,10 +107,10 @@ logfile = open( file_path, 'wb' ) logfile.write( "\n#############################################" ) logfile.write( '\n%s\nSTDOUT\n' % command ) + logfile.write( str( fabric_AttributeString.stdout ) ) logfile.write( "#############################################\n" ) - logfile.write( str( fabric_AttributeString.stdout ) ) logfile.write( "\n#############################################" ) logfile.write( '\n%s\nSTDERR\n' % command ) + logfile.write( str( fabric_AttributeString.stderr ) ) logfile.write( "#############################################\n" ) - logfile.write( str( fabric_AttributeString.stderr ) ) logfile.close() diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 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 @@ -11,131 +11,132 @@ from elementtree import ElementTree, ElementInclude from elementtree.ElementTree import Element, SubElement -def create_or_update_tool_dependency( app, tool_shed_repository, changeset_revision, name, version, type ): - """ - This method is called from Galaxy (never the tool shed) when a new tool_shed_repository is being installed or when an ininstalled repository is - being reinstalled. - """ - # First see if a tool_dependency record exists for the received changeset_revision. +def create_or_update_tool_dependency( app, tool_shed_repository, name, version, type ): + # Called from Galaxy (never the tool shed) when a new repository is being installed or when an uninstalled repository is being reinstalled. + # First see if an appropriate tool_dependency record exists for the received tool_shed_repository. sa_session = app.model.context.current - tool_dependency = get_tool_dependency_by_shed_changeset_revision( app, tool_shed_repository, name, version, type, changeset_revision ) + tool_dependency = get_tool_dependency_by_name_version_type_repository( app, tool_shed_repository, name, version, type ) if tool_dependency: tool_dependency.uninstalled = False else: - # Check the tool_shed_repository's set of tool_depnedency records for any that are marked uninstalled. If one is found, set uninstalled to - # False and update the value of installed_changeset_revision. - found = False - for tool_dependency in tool_shed_repository.tool_dependencies: - if tool_dependency.name == name and tool_dependency.version == version and tool_dependency.type == type and tool_dependency.uninstalled: - found = True - tool_dependency.uninstalled = False - tool_dependency.installed_changeset_revision = changeset_revision - break - if not found: - # Create a new tool_dependency record for the tool_shed_repository. - tool_dependency = app.model.ToolDependency( tool_shed_repository_id=tool_shed_repository.id, - installed_changeset_revision=changeset_revision, - name=name, - version=version, - type=type ) + # Create a new tool_dependency record for the tool_shed_repository. + tool_dependency = app.model.ToolDependency( tool_shed_repository_id=tool_shed_repository.id, + name=name, + version=version, + type=type ) sa_session.add( tool_dependency ) sa_session.flush() return tool_dependency -def get_tool_dependency_install_dir( app, repository, installed_changeset_revision, package_name, package_version ): +def get_tool_dependency_by_name_version_type_repository( app, repository, name, version, type ): + sa_session = app.model.context.current + return sa_session.query( app.model.ToolDependency ) \ + .filter( and_( app.model.ToolDependency.table.c.tool_shed_repository_id == repository.id, + app.model.ToolDependency.table.c.name == name, + app.model.ToolDependency.table.c.version == version, + app.model.ToolDependency.table.c.type == type ) ) \ + .first() +def get_tool_dependency_install_dir( app, repository, package_name, package_version ): return os.path.abspath( os.path.join( app.config.tool_dependency_dir, package_name, package_version, repository.owner, repository.name, - installed_changeset_revision ) ) -def get_tool_dependency_by_shed_changeset_revision( app, repository, dependency_name, dependency_version, dependency_type, changeset_revision ): - sa_session = app.model.context.current - return sa_session.query( app.model.ToolDependency ) \ - .filter( and_( app.model.ToolDependency.table.c.tool_shed_repository_id == repository.id, - app.model.ToolDependency.table.c.name == dependency_name, - app.model.ToolDependency.table.c.version == dependency_version, - app.model.ToolDependency.table.c.type == dependency_type, - app.model.ToolDependency.table.c.installed_changeset_revision == changeset_revision ) ) \ - .first() -def install_package( app, elem, tool_shed_repository, installed_changeset_revision ): + repository.installed_changeset_revision ) ) +def install_package( app, elem, tool_shed_repository, name=None, version=None ): + # If name and version are not None, then a specific tool dependency is being installed. + message = '' # The value of package_name should match the value of the "package" type in the tool config's <requirements> tag set, but it's not required. - message = '' package_name = elem.get( 'name', None ) package_version = elem.get( 'version', None ) if package_name and package_version: - install_dir = get_install_dir( app, tool_shed_repository, installed_changeset_revision, package_name, package_version ) - if not_installed( 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 script provided by Galaxy. Example tag set definition: - fabfile_path = None - for method_elem in package_elem.findall( 'method' ): - error_message = run_fabric_method( app, - method_elem, - fabfile_path, - app.config.tool_dependency_dir, - install_dir, - package_name=package_name ) - if error_message: - message += '%s' % error_message - else: - tool_dependency = create_or_update_tool_dependency( app, - tool_shed_repository, - installed_changeset_revision, - name=package_name, - version=package_version, - type='package' ) - print package_name, 'version', package_version, 'installed in', install_dir - else: - print '\nSkipping installation of tool dependency', package_name, 'version', package_version, 'since it is installed in', install_dir, '\n' + if ( not name and not version ) or ( name and version and name==package_name and version==package_version ): + 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: + error_message = run_fabric_method( app, + method_elem, + fabfile_path, + app.config.tool_dependency_dir, + install_dir, + package_name=package_name ) + if error_message: + message += '%s' % error_message + else: + tool_dependency = create_or_update_tool_dependency( app, + tool_shed_repository, + name=package_name, + version=package_version, + type='package' ) + print package_name, 'version', package_version, 'installed in', install_dir + else: + print '\nSkipping installation of tool dependency', package_name, 'version', package_version, 'since it is installed in', install_dir, '\n' return message -def not_installed( install_dir ): - # TODO: try executing a binary or something in addition to just seeing if the install_dir exists. - return not os.path.exists( install_dir ) def run_fabric_method( app, elem, fabfile_path, tool_dependency_dir, 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.""" 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' ) + else: + env_dependency_path = install_dir method_name = elem.get( 'name', None ) params_dict = dict( install_dir=install_dir ) - build_commands = [] + actions = [] for param_elem in elem: param_name = param_elem.get( 'name' ) if param_name: - if param_name == 'build_commands': - for build_command_elem in param_elem: - build_command_dict = {} - build_command_name = build_command_elem.get( 'name' ) - if build_command_name: - if build_command_name in MOVE_BUILD_COMMAND_NAMES: - build_command_key = build_command_name - for move_elem in build_command_elem: - move_elem_text = move_elem.text.replace( '$INSTALL_DIR', install_dir ) - if move_elem_text: - build_command_dict[ move_elem.tag ] = move_elem_text - elif build_command_elem.text: - build_command_key = '%sv^v^v%s' % ( build_command_name, build_command_elem.text ) - else: + 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_ACTIONS: + # 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 + elif action_elem.text: + # Example: <action type="change_directory">bin</action> + action_key = '%sv^v^v%s' % ( action_type, action_elem.text ) else: - build_command_key = build_command_elem.text.replace( '$INSTALL_DIR', install_dir ) - if not build_command_key: - continue - build_commands.append( ( build_command_key, build_command_dict ) ) - if build_commands: - params_dict[ 'build_commands' ] = build_commands + 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 + params_dict[ param_name ] = param_elem.text.replace( '$INSTALL_DIR', install_dir ) if package_name: params_dict[ 'package_name' ] = package_name if fabfile_path: @@ -151,7 +152,7 @@ except Exception, e: return '%s. ' % str( e ) try: - message = handle_post_build_processing( tool_dependency_dir, install_dir, package_name=package_name ) + message = handle_post_build_processing( tool_dependency_dir, install_dir, env_dependency_path, package_name=package_name ) if message: return message except: @@ -164,17 +165,19 @@ """ if not os.path.exists( install_dir ): os.makedirs( install_dir ) + # Default value for env_dependency_path. + env_dependency_path = install_dir method_name = elem.get( 'name', None ) params_str = '' - build_commands = [] + actions = [] for param_elem in elem: param_name = param_elem.get( 'name' ) if param_name: - if param_name == 'build_commands': - for build_command_elem in param_elem: - build_commands.append( build_command_elem.text.replace( '$INSTALL_DIR', install_dir ) ) - if build_commands: - params_str += 'build_commands=%s,' % tool_shed_encode( encoding_sep.join( build_commands ) ) + if param_name == 'actions': + for action_elem in param_elem: + actions.append( action_elem.text.replace( '$INSTALL_DIR', install_dir ) ) + if actions: + params_str += 'actions=%s,' % tool_shed_encode( encoding_sep.join( actions ) ) else: if param_elem.text: param_value = tool_shed_encode( param_elem.text ) @@ -190,7 +193,7 @@ return "Exception executing fabric script %s: %s. " % ( str( fabfile_path ), str( e ) ) if returncode: return message - message = handle_post_build_processing( tool_dependency_dir, install_dir, package_name=package_name ) + message = handle_post_build_processing( tool_dependency_dir, install_dir, env_dependency_path, package_name=package_name ) if message: return message else: diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -798,11 +798,11 @@ def tool_shed_repository( self ): # If this tool is included in an installed tool shed repository, return it. if self.tool_shed: - return get_tool_shed_repository_by_shed_name_owner_changeset_revision( self.app, - self.tool_shed, - self.repository_name, - self.repository_owner, - self.installed_changeset_revision ) + return get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( self.app, + self.tool_shed, + self.repository_name, + self.repository_owner, + self.installed_changeset_revision ) return None def __get_job_run_config( self, run_configs, key, job_params=None ): # Look through runners/handlers to find one with matching parameters. diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/tools/deps/__init__.py --- a/lib/galaxy/tools/deps/__init__.py +++ b/lib/galaxy/tools/deps/__init__.py @@ -44,18 +44,20 @@ def _find_dep_versioned( self, name, version, type='package', installed_tool_dependencies=None ): installed_dependency = None if installed_tool_dependencies: - for installed_dependency in installed_tool_dependencies: - if not installed_dependency.uninstalled: - if installed_dependency.name==name and installed_dependency.version==version and installed_dependency.type==type: + for installed_tool_dependency in installed_tool_dependencies: + if not installed_tool_dependency.uninstalled: + if installed_tool_dependency.name==name and installed_tool_dependency.version==version and installed_tool_dependency.type==type: + installed_dependency = installed_tool_dependency break for base_path in self.base_paths: if installed_dependency: tool_shed_repository = installed_dependency.tool_shed_repository path = os.path.join( base_path, - name, version, + name, + version, tool_shed_repository.owner, tool_shed_repository.name, - installed_dependency.installed_changeset_revision ) + tool_shed_repository.installed_changeset_revision ) else: path = os.path.join( base_path, name, version ) script = os.path.join( path, 'env.sh' ) diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -326,7 +326,11 @@ if not owner: owner = get_repository_owner_from_clone_url( repository_clone_url ) includes_datatypes = 'datatypes' in metadata_dict - tool_shed_repository = get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( app, tool_shed, name, owner, installed_changeset_revision ) + tool_shed_repository = get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( app, + tool_shed, + name, + owner, + installed_changeset_revision ) if tool_shed_repository: tool_shed_repository.description = description tool_shed_repository.changeset_revision = current_changeset_revision @@ -425,10 +429,10 @@ for tool_dict in metadata_dict[ 'tools' ]: requirements = tool_dict.get( 'requirements', [] ) for requirement_dict in requirements: - requirement_name = requirement_dict.get( 'name', None ) - requirement_version = requirement_dict.get( 'version', None ) - requirement_type = requirement_dict.get( 'type', None ) - if requirement_name == tool_dependency_name and requirement_version == tool_dependency_version and requirement_type == tool_dependency_type: + req_name = requirement_dict.get( 'name', None ) + req_version = requirement_dict.get( 'version', None ) + req_type = requirement_dict.get( 'type', None ) + if req_name==tool_dependency_name and req_version==tool_dependency_version and req_type==tool_dependency_type: can_generate_dependency_metadata = True break if not can_generate_dependency_metadata: @@ -1159,13 +1163,13 @@ message = str( e ) error = True return error, message -def handle_tool_dependencies( app, tool_shed_repository, installed_changeset_revision, tool_dependencies_config ): +def handle_tool_dependencies( app, tool_shed_repository, tool_dependencies_config, name=None, version=None, type='package' ): """ 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. Future enhancements to handling tool dependencies may provide installation processes in addition to fabric based processes. The dependencies will be installed in: - ~/<app.config.tool_dependency_dir>/<package_name>/<package_version>/<repository_owner>/<repository_name>/<installed_changeset_revision> + ~/<app.config.tool_dependency_dir>/<package_name>/<package_version>/<repo_owner>/<repo_name>/<repo_installed_changeset_revision> """ status = 'ok' message = '' @@ -1175,8 +1179,8 @@ ElementInclude.include( root ) fabric_version_checked = False for elem in root: - if elem.tag == 'package': - error_message = install_package( app, elem, tool_shed_repository, installed_changeset_revision ) + if elem.tag == type: + error_message = install_package( app, elem, tool_shed_repository, name=name, version=version ) if error_message: message += ' %s' % error_message if message: @@ -1288,12 +1292,9 @@ tool_shed_repository, current_changeset_revision, work_dir ) - # Install dependencies for repository tools. The tool_dependency.installed_changeset_revision value will be the value of - # tool_shed_repository.changeset_revision (this method's current_changeset_revision). This approach will allow for different - # versions of the same tool_dependency to be installed for associated versions of tools included in the installed repository. + # Install dependencies for repository tools. status, message = handle_tool_dependencies( app=trans.app, tool_shed_repository=tool_shed_repository, - installed_changeset_revision=current_changeset_revision, tool_dependencies_config=tool_dependencies_config ) if status != 'ok' and message: print 'The following error occurred from load_repository_contents while installing tool dependencies:' diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -2,7 +2,7 @@ from galaxy.web.controllers.admin import * from galaxy.util.json import from_json_string, to_json_string from galaxy.util.shed_util import * -from galaxy.tool_shed.tool_dependencies.install_util import get_tool_dependency_install_dir, not_installed +from galaxy.tool_shed.tool_dependencies.install_util import get_tool_dependency_install_dir from galaxy.tool_shed.encoding_util import * from galaxy import eggs, tools @@ -196,6 +196,7 @@ repository = get_repository( trans, kwd[ 'id' ] ) shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository ) repository_install_dir = os.path.abspath ( relative_install_dir ) + errors = '' if params.get( 'deactivate_or_uninstall_repository_button', False ): if repository.includes_tools: # Handle tool panel alterations. @@ -218,32 +219,24 @@ removed = False if removed: repository.uninstalled = True - # Remove all installed tool dependencies - this is required when uninstalling the repository. - for tool_dependency in repository.tool_dependencies: - dependency_install_dir = os.path.abspath( os.path.join( trans.app.config.tool_dependency_dir, - tool_dependency.name, - tool_dependency.version, - repository.owner, - repository.name, - tool_dependency.installed_changeset_revision ) ) - try: - shutil.rmtree( dependency_install_dir ) - log.debug( "Removed tool dependency installation directory: %s" % str( dependency_install_dir ) ) - removed = True - except Exception, e: - log.debug( "Error removing tool dependency installation directory %s: %s" % ( str( dependency_install_dir ), str( e ) ) ) - removed = False - if removed: - tool_dependency.uninstalled = True - trans.sa_session.add( tool_dependency ) + # Remove all installed tool dependencies. + for tool_dependency in repository.installed_tool_dependencies: + uninstalled, error_message = remove_tool_dependency( trans, tool_dependency ) + if error_message: + errors = '%s %s' % ( errors, error_message ) repository.deleted = True trans.sa_session.add( repository ) trans.sa_session.flush() if remove_from_disk_checked: - message = 'The repository named <b>%s</b> has been uninstalled.' % repository.name + message = 'The repository named <b>%s</b> has been uninstalled. ' % repository.name + if errors: + message += 'Attempting to uninstall tool dependencies resulted in errors: %s' % errors + status = 'error' + else: + status = 'done' else: - message = 'The repository named <b>%s</b> has been deactivated.' % repository.name - status = 'done' + message = 'The repository named <b>%s</b> has been deactivated. ' % repository.name + status = 'done' return trans.response.send_redirect( web.url_for( controller='admin_toolshed', action='browse_repositories', message=message, @@ -277,33 +270,6 @@ return get_repository_file_contents( file_path ) @web.expose @web.require_admin - def install_tool_dependencies( self, trans, **kwd ): - """Install dependencies for tools included in the repository when the repository is being installed.""" - message = kwd.get( 'message', '' ) - status = kwd.get( 'status', 'done' ) - tool_shed_url = kwd[ 'tool_shed_url' ] - repo_info_dict = kwd[ 'repo_info_dict' ] - includes_tools = util.string_as_bool( kwd.get( 'includes_tools', False ) ) - # Decode the encoded repo_info_dict param value. - dict_with_tool_dependencies = tool_shed_decode( repo_info_dict ) - # The repo_info_dict includes tool dependencies which we need to display so the user knows what will be installed. - new_repo_info_dict = {} - for name, repo_info_tuple in dict_with_tool_dependencies.items(): - description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple - # Create a new repo_info_dict by eliminating tool-dependencies from the repo_info_tuple. - new_repo_info_dict[ name ] = ( description, repository_clone_url, changeset_revision, ctx_rev ) - repo_info_dict = tool_shed_encode( new_repo_info_dict ) - install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True ) - return trans.fill_template( '/admin/tool_shed_repository/install_tool_dependencies.mako', - tool_shed_url=tool_shed_url, - repo_info_dict=repo_info_dict, - dict_with_tool_dependencies=dict_with_tool_dependencies, - includes_tools=includes_tools, - install_tool_dependencies_check_box=install_tool_dependencies_check_box, - message=message, - status=status ) - @web.expose - @web.require_admin def install_missing_tool_dependencies( self, trans, **kwd ): """ Install dependencies for tools included in the repository that were not installed when the repository was installed or that are @@ -327,18 +293,15 @@ install_dir=relative_install_dir ) status, message = handle_tool_dependencies( app=trans.app, tool_shed_repository=repository, - installed_changeset_revision=repository.installed_changeset_revision, tool_dependencies_config=tool_dependencies_config ) try: shutil.rmtree( work_dir ) except: pass - tool_dependencies_missing = status == 'error' return trans.fill_template( '/admin/tool_shed_repository/manage_repository.mako', repository=repository, description=repository.description, repo_files_dir=repo_files_dir, - tool_dependencies_missing=tool_dependencies_missing, message=message, status=status ) if reinstalling and kwd.get( 'install_missing_tool_dependencies_button', False ): @@ -352,12 +315,11 @@ if not reinstalling: # Filter the tool_dependencies dictionary to eliminate successfully installed dependencies. filtered_tool_dependencies = {} - for dependency_key, requirements_dict in tool_dependencies.items(): - name = requirements_dict[ 'name' ] - version = requirements_dict[ 'version' ] - install_dir = get_tool_dependency_install_dir( trans.app, repository, repository.changeset_revision, name, version ) - if not_installed( install_dir ): - filtered_tool_dependencies[ dependency_key ] = requirements_dict + for missing_dependency_tup in repository.missing_tool_dependencies: + name, version, type = missing_dependency_tup + dependency_key = '%s/%s' % ( name, version ) + install_dir = get_tool_dependency_install_dir( trans.app, repository, name, version ) + filtered_tool_dependencies[ dependency_key ] = dict( name=name, type=type, version=version ) tool_dependencies = filtered_tool_dependencies no_changes = kwd.get( 'no_changes', '' ) no_changes_checked = CheckboxField.is_checked( no_changes ) @@ -557,6 +519,66 @@ status=status ) @web.expose @web.require_admin + def install_tool_dependencies( self, trans, **kwd ): + """Install dependencies for tools included in the repository when the repository is being installed.""" + message = kwd.get( 'message', '' ) + status = kwd.get( 'status', 'done' ) + tool_shed_url = kwd[ 'tool_shed_url' ] + repo_info_dict = kwd[ 'repo_info_dict' ] + includes_tools = util.string_as_bool( kwd.get( 'includes_tools', False ) ) + # Decode the encoded repo_info_dict param value. + dict_with_tool_dependencies = tool_shed_decode( repo_info_dict ) + # The repo_info_dict includes tool dependencies which we need to display so the user knows what will be installed. + new_repo_info_dict = {} + for name, repo_info_tuple in dict_with_tool_dependencies.items(): + description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple + # Create a new repo_info_dict by eliminating tool-dependencies from the repo_info_tuple. + new_repo_info_dict[ name ] = ( description, repository_clone_url, changeset_revision, ctx_rev ) + repo_info_dict = tool_shed_encode( new_repo_info_dict ) + install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True ) + return trans.fill_template( '/admin/tool_shed_repository/install_tool_dependencies.mako', + tool_shed_url=tool_shed_url, + repo_info_dict=repo_info_dict, + dict_with_tool_dependencies=dict_with_tool_dependencies, + includes_tools=includes_tools, + install_tool_dependencies_check_box=install_tool_dependencies_check_box, + message=message, + status=status ) + @web.expose + @web.require_admin + def install_tool_dependency( self, trans, name, version, type, repository_id, **kwd ): + """Install dependencies for tools included in the repository when the repository is being installed.""" + message = kwd.get( 'message', '' ) + status = kwd.get( 'status', 'done' ) + repository = get_repository( trans, repository_id ) + shed_tool_conf, tool_path, relative_install_dir = get_tool_panel_config_tool_path_install_dir( trans.app, repository ) + repo_files_dir = os.path.abspath( os.path.join( relative_install_dir, repository.name ) ) + # Get the tool_dependencies.xml file from the repository. + work_dir = make_tmp_directory() + tool_dependencies_config = get_config_from_repository( trans.app, + 'tool_dependencies.xml', + repository, + repository.changeset_revision, + work_dir, + install_dir=relative_install_dir ) + status, message = handle_tool_dependencies( app=trans.app, + tool_shed_repository=repository, + tool_dependencies_config=tool_dependencies_config, + name=name, + version=version, + type=type ) + try: + shutil.rmtree( work_dir ) + except: + pass + return trans.fill_template( '/admin/tool_shed_repository/manage_repository.mako', + repository=repository, + description=repository.description, + repo_files_dir=repo_files_dir, + message=message, + status=status ) + @web.expose + @web.require_admin def manage_repository( self, trans, **kwd ): params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) @@ -791,6 +813,24 @@ status=status ) @web.expose @web.require_admin + def uninstall_tool_dependency( self, trans, **kwd ): + params = util.Params( kwd ) + message = util.restore_text( params.get( 'message', '' ) ) + status = params.get( 'status', 'done' ) + repository = get_repository( trans, kwd[ 'repository_id' ] ) + tool_dependency = get_tool_dependency( trans, kwd[ 'id' ] ) + uninstalled, error_message = remove_tool_dependency( trans, tool_dependency ) + if uninstalled: + message = "The '%s' tool dependency has been uninstalled." % tool_dependency.name + else: + message = "Error attempting to uninstall the '%s' tool dependency: %s" % ( tool_dependency.name, error_message ) + status = 'error' + return trans.fill_template( '/admin/tool_shed_repository/manage_tool_dependencies.mako', + repository=repository, + message=message, + status=status ) + @web.expose + @web.require_admin def update_to_changeset_revision( self, trans, **kwd ): """Update a cloned repository to the latest revision possible.""" params = util.Params( kwd ) diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/browse_repository.mako --- a/templates/admin/tool_shed_repository/browse_repository.mako +++ b/templates/admin/tool_shed_repository/browse_repository.mako @@ -19,10 +19,13 @@ <div popupmenu="repository-${repository.id}-popup"><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or Uninstall</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a> %if repository.tool_dependencies: <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> %endif + %if repository.missing_tool_dependencies: + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='install_missing_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Install missing tool dependencies</a> + %endif </div></ul> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/browse_tool_dependency.mako --- a/templates/admin/tool_shed_repository/browse_tool_dependency.mako +++ b/templates/admin/tool_shed_repository/browse_tool_dependency.mako @@ -17,12 +17,12 @@ <ul class="manage-table-actions"><li><a class="action-button" id="tool_dependency-${tool_dependency.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="tool_dependency-${tool_dependency.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">Browse repository files</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or Uninstall</a> - %if repository.tool_dependencies: - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> - %endif + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='uninstall_tool_dependency', id=trans.security.encode_id( tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}">Uninstall this tool dependency</a></div></ul> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/install_missing_tool_dependencies.mako --- a/templates/admin/tool_shed_repository/install_missing_tool_dependencies.mako +++ b/templates/admin/tool_shed_repository/install_missing_tool_dependencies.mako @@ -3,6 +3,23 @@ <% import os %> +<br/><br/> +<ul class="manage-table-actions"> + <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> + <div popupmenu="repository-${repository.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">Browse repository files</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a> + %if repository.includes_tools: + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='set_tool_versions', id=trans.security.encode_id( repository.id ) )}">Set tool versions</a> + %endif + %if repository.tool_dependencies: + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> + %endif + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a> + </div> +</ul> + %if message: ${render_msg( message, status )} %endif @@ -33,10 +50,10 @@ <form name="install_missing_tool_dependencies" id="install_missing_tool_dependencies" action="${h.url_for( controller='admin_toolshed', action='install_missing_tool_dependencies', id=trans.security.encode_id( repository.id ), tool_panel_section=tool_panel_section, new_tool_panel_section=new_tool_panel_section, reinstalling=reinstalling )}" method="post" ><div style="clear: both"></div><div class="form-row"> - <label>Install tool dependencies?</label> + <label>Install missing tool dependencies?</label> ${install_tool_dependencies_check_box.get_html()} <div class="toolParamHelp" style="clear: both;"> - Un-check to skip installation of these tool dependencies. + Un-check to skip installation of these missing tool dependencies. </div> ## Fake the no_changes_check_box value. %if no_changes_checked: @@ -48,7 +65,7 @@ <div style="clear: both"></div><div class="form-row"><table class="grid"> - <tr><td colspan="4" bgcolor="#D8D8D8"><b>Tool dependencies</b></td></tr> + <tr><td colspan="4" bgcolor="#D8D8D8"><b>Missing tool dependencies</b></td></tr><tr><th>Name</th><th>Version</th> @@ -68,6 +85,7 @@ repository.changeset_revision ) readme_text = requirements_dict.get( 'readme', None ) %> + %if not os.path.exists( install_dir ): <tr><td>${name}</td><td>${version}</td> @@ -78,6 +96,7 @@ <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr><tr><td colspan="4"><pre>${readme_text}</pre></td></tr> %endif + %endif %endfor </table><div style="clear: both"></div> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/install_tool_dependencies.mako --- a/templates/admin/tool_shed_repository/install_tool_dependencies.mako +++ b/templates/admin/tool_shed_repository/install_tool_dependencies.mako @@ -61,6 +61,7 @@ changeset_revision ) readme_text = requirements_dict.get( 'readme', None ) %> + %if not os.path.exists( install_dir ): <tr><td>${name}</td><td>${version}</td> @@ -71,6 +72,7 @@ <tr><td colspan="4" bgcolor="#FFFFCC">${name} ${version} requirements and installation information</td></tr><tr><td colspan="4"><pre>${readme_text}</pre></td></tr> %endif + %endif %endfor %endfor </table> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 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 @@ -14,7 +14,10 @@ %if repository.tool_dependencies: <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> %endif - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or Uninstall</a> + %if repository.missing_tool_dependencies: + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='install_missing_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Install missing tool dependencies</a> + %endif + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a></div></ul> @@ -85,14 +88,24 @@ <table class="grid"><tr><td><b>name</b></td> + <td><b>version</b></td><td><b>type</b></td> - <td><b>version</b></td></tr> - %for name, requirements_dict in missing_tool_dependencies.items(): + %for index, missing_dependency_tup in enumerate( missing_tool_dependencies ): + <% name, version, type = missing_dependency_tup %><tr> - <td>${requirements_dict[ 'name' ]}</td> - <td>${requirements_dict[ 'type' ]}</td> - <td>${requirements_dict[ 'version' ]}</td> + <td> + <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="missing_dependency-${index}-popup"> + <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='install_tool_dependency', name=name, version=version, type=type, repository_id=trans.security.encode_id( repository.id ) )}"> + ${name} + </a> + </div> + <div popupmenu="missing_dependency-${index}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='install_tool_dependency', name=name, version=version, type=type, repository_id=trans.security.encode_id( repository.id ) )}">Install this dependency</a> + </div> + </td> + <td>${version}</td> + <td>${type}</td></tr> %endfor </table> @@ -112,18 +125,23 @@ <table class="grid"><tr><td><b>name</b></td> + <td><b>version</b></td><td><b>type</b></td> - <td><b>version</b></td></tr> %for installed_tool_dependency in installed_tool_dependencies: <tr><td> - <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( installed_tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}"> - ${installed_tool_dependency.name} - </a> + <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="dependency-${installed_tool_dependency.id}-popup"> + <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( installed_tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}"> + ${installed_tool_dependency.name} + </a> + </div> + <div popupmenu="dependency-${installed_tool_dependency.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='uninstall_tool_dependency', id=trans.security.encode_id( installed_tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}">Uninstall this dependency</a> + </div></td> + <td>${installed_tool_dependency.version}</td><td>${installed_tool_dependency.type}</td> - <td>${installed_tool_dependency.version}</td></tr> %endfor </table> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/manage_tool_dependencies.mako --- a/templates/admin/tool_shed_repository/manage_tool_dependencies.mako +++ b/templates/admin/tool_shed_repository/manage_tool_dependencies.mako @@ -7,6 +7,7 @@ <ul class="manage-table-actions"><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">Browse repository files</a><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get updates</a> %if repository.includes_tools: @@ -15,7 +16,7 @@ %if repository.missing_tool_dependencies: <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='install_missing_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Install missing tool dependencies</a> %endif - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or Uninstall</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a></div></ul> @@ -24,7 +25,7 @@ %endif <div class="toolForm"> - <div class="toolFormTitle">${repository.name} repository's tool dependencies</div> + <div class="toolFormTitle">Repository '${repository.name}' tool dependencies</div><div class="toolFormBody"><div class="form-row"><table class="grid"> @@ -33,32 +34,46 @@ name = tool_dependency.name version = tool_dependency.version type = tool_dependency.type - installed_changeset_revision = tool_dependency.installed_changeset_revision uninstalled = tool_dependency.uninstalled - install_dir = os.path.abspath( os.path.join( trans.app.config.tool_dependency_dir, - name, - version, - repository.owner, - repository.name, - installed_changeset_revision ) ) + install_dir = tool_dependency.installation_directory( trans.app ) %> - <tr><td bgcolor="#D8D8D8"><b>Name</b></td><td bgcolor="#D8D8D8">${name}</td></tr> - <tr><th>Version</th><td>${version}</td></tr> - <tr><th>Type</th><td>${type}</td></tr> - <tr> - <th>Install directory</th> - <td> + <tr> + <td bgcolor="#D8D8D8"> + <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="dependency-${tool_dependency.id}-popup"> %if uninstalled: - This dependency is not currently installed + <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='install_tool_dependency', name=name, version=version, type=type, repository_id=trans.security.encode_id( repository.id ) )}"> + <b>Name</b> + </a> + <div popupmenu="dependency-${tool_dependency.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='install_tool_dependency', name=name, version=version, type=type, repository_id=trans.security.encode_id( repository.id ) )}">Install this dependency</a> + </div> %else: <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}"> - ${install_dir} + <b>Name</b></a> + <div popupmenu="dependency-${tool_dependency.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='uninstall_tool_dependency', id=trans.security.encode_id( tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}">Uninstall this dependency</a> + </div> %endif - </td> - </tr> - <tr><th>Installed changeset revision</th><td>${installed_changeset_revision}</td></tr> - <tr><th>Uninstalled</th><td>${uninstalled}</td></tr> + </div> + </td> + <td bgcolor="#D8D8D8">${name}</td> + </tr> + <tr><th>Version</th><td>${version}</td></tr> + <tr><th>Type</th><td>${type}</td></tr> + <tr> + <th>Install directory</th> + <td> + %if uninstalled: + This dependency is not currently installed + %else: + <a class="view-info" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( tool_dependency.id ), repository_id=trans.security.encode_id( repository.id ) )}"> + ${install_dir} + </a> + %endif + </td> + </tr> + <tr><th>Uninstalled</th><td>${uninstalled}</td></tr> %endfor </table><div style="clear: both"></div> diff -r 87be4c8d7f7fa32f6023f0e251e3c9af8447f5cd -r 7c495f835a1d436ad33dff6107784f106cc24980 templates/admin/tool_shed_repository/view_tool_metadata.mako --- a/templates/admin/tool_shed_repository/view_tool_metadata.mako +++ b/templates/admin/tool_shed_repository/view_tool_metadata.mako @@ -11,7 +11,7 @@ %if repository.tool_dependencies: <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( repository.id ) )}">Manage tool dependencies</a> %endif - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or Uninstall</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a></div></ul> 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