commit/galaxy-central: dan: Fix for detecting Data Manager tool dependencies when installed from a tool shed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d8259d7fcba0/ Changeset: d8259d7fcba0 User: dan Date: 2013-05-21 22:21:17 Summary: Fix for detecting Data Manager tool dependencies when installed from a tool shed. Affected #: 2 files diff -r 856800d4c91546d51948176f4b78a7bd4b1a1b8b -r d8259d7fcba011f1d97eb808d7812346d0ef8739 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -952,6 +952,8 @@ self.version = None # Enable easy access to this tool's version lineage. self.lineage_ids = [] + #populate toolshed repository info, if available + self.populate_tool_shed_info() # Parse XML element containing configuration self.parse( root, guid=guid ) self.external_runJob_script = app.config.drmaa_external_runjob_script @@ -1775,6 +1777,17 @@ version = requirement_elem.get( "version", None ) requirement = ToolRequirement( name=name, type=type, version=version ) self.requirements.append( requirement ) + + def populate_tool_shed_info( self ): + if self.repository_id is not None and 'ToolShedRepository' in self.app.model: + repository_id = self.app.security.decode_id( self.repository_id ) + tool_shed_repository = self.sa_session.query( self.app.model.ToolShedRepository ).get( repository_id ) + if tool_shed_repository: + self.tool_shed = tool_shed_repository.tool_shed + self.repository_name = tool_shed_repository.name + self.repository_owner = tool_shed_repository.owner + self.installed_changeset_revision = tool_shed_repository.installed_changeset_revision + def check_workflow_compatible( self, root ): """ Determine if a tool can be used in workflows. External tools and the diff -r 856800d4c91546d51948176f4b78a7bd4b1a1b8b -r d8259d7fcba011f1d97eb808d7812346d0ef8739 lib/galaxy/tools/data_manager/manager.py --- a/lib/galaxy/tools/data_manager/manager.py +++ b/lib/galaxy/tools/data_manager/manager.py @@ -9,6 +9,7 @@ from galaxy.util.odict import odict from galaxy.util.template import fill_template from galaxy.tools.data import TabularToolDataTable +import tool_shed.util.shed_util_common as suc #set up logger import logging @@ -113,12 +114,20 @@ self.guid = elem.get( 'guid', None ) path = elem.get( 'tool_file', None ) self.version = elem.get( 'version', self.version ) + tool_shed_repository_id = None tool_guid = None if path is None: tool_elem = elem.find( 'tool' ) assert tool_elem is not None, "Error loading tool for data manager. Make sure that a tool_file attribute or a tool tag set has been defined:\n%s" % ( util.xml_to_string( elem ) ) path = tool_elem.get( "file", None ) tool_guid = tool_elem.get( "guid", None ) + #need to determine repository info so that dependencies will work correctly + tool_shed = tool_elem.find( 'tool_shed' ).text + repository_name = tool_elem.find( 'repository_name' ).text + repository_owner = tool_elem.find( 'repository_owner' ).text + installed_changeset_revision = tool_elem.find( 'installed_changeset_revision' ).text + tool_shed_repository = suc.get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( self.data_managers.app, tool_shed, repository_name, repository_owner, installed_changeset_revision ) + tool_shed_repository_id = self.data_managers.app.security.encode_id( tool_shed_repository.id ) #use shed_conf_file to determine tool_path shed_conf_file = elem.get( "shed_conf_file", None ) if shed_conf_file: @@ -126,7 +135,7 @@ if shed_conf: tool_path = shed_conf.get( "tool_path", tool_path ) assert path is not None, "A tool file path could not be determined:\n%s" % ( util.xml_to_string( elem ) ) - self.load_tool( os.path.join( tool_path, path ), guid=tool_guid, data_manager_id=self.id ) + self.load_tool( os.path.join( tool_path, path ), guid=tool_guid, data_manager_id=self.id, tool_shed_repository_id=tool_shed_repository_id ) self.name = elem.get( 'name', self.tool.name ) self.description = elem.get( 'description', self.tool.description ) @@ -180,8 +189,8 @@ @property def id( self ): return self.guid or self.declared_id #if we have a guid, we will use that as the data_manager id - def load_tool( self, tool_filename, guid=None, data_manager_id=None ): - tool = self.data_managers.app.toolbox.load_tool( tool_filename, guid=guid, data_manager_id=data_manager_id ) + def load_tool( self, tool_filename, guid=None, data_manager_id=None, tool_shed_repository_id=None ): + tool = self.data_managers.app.toolbox.load_tool( tool_filename, guid=guid, data_manager_id=data_manager_id, repository_id=tool_shed_repository_id ) self.data_managers.app.toolbox.data_manager_tools[ tool.id ] = tool self.data_managers.app.toolbox.tools_by_id[ tool.id ] = tool self.tool = tool 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)
-
commits-noreply@bitbucket.org