diff --git a/lib/galaxy/objectstore/__init__.py b/lib/galaxy/objectstore/__init__.py index 748c74257c9..bf650139105 100644 --- a/lib/galaxy/objectstore/__init__.py +++ b/lib/galaxy/objectstore/__init__.py @@ -223,7 +223,7 @@ class DiskObjectStore(ObjectStore): if not os.path.exists(path): return self._construct_path(obj, base_dir=base_dir, dir_only=dir_only, extra_dir=extra_dir, extra_dir_at_root=extra_dir_at_root, alt_name=alt_name) - def _construct_path(self, obj, old_style=False, base_dir=None, dir_only=False, extra_dir=None, extra_dir_at_root=False, alt_name=None): + def _construct_path(self, obj, old_style=False, base_dir=None, dir_only=False, extra_dir=None, extra_dir_at_root=False, alt_name=None, **kwargs): """ Construct the expected absolute path for accessing the object identified by `obj`.id. diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 78aa13597f0..f34a51def49 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2181,7 +2181,7 @@ class Tool: sa_session=self.sa_session ) self.app.security_agent.copy_dataset_permissions( outdata.dataset, child_dataset.dataset ) # Move data from temp location to dataset location - self.app.object_store.update_from_file(child_dataset.dataset, filename, create=True) + self.app.object_store.update_from_file(child_dataset.dataset, file_name=filename, create=True) self.sa_session.add( child_dataset ) self.sa_session.flush() child_dataset.set_size() @@ -2248,7 +2248,7 @@ class Tool: self.sa_session.add( primary_data ) self.sa_session.flush() # Move data from temp location to dataset location - self.app.object_store.update_from_file(primary_data.dataset, filename, create=True) + self.app.object_store.update_from_file(primary_data.dataset, file_name=filename, create=True) primary_data.set_size() primary_data.name = "%s (%s)" % ( outdata.name, designation ) primary_data.info = outdata.info diff --git a/lib/galaxy/web/controllers/admin_toolshed.py b/lib/galaxy/web/controllers/admin_toolshed.py index 9e1a9ff8c00..98307313e6a 100644 --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -367,6 +367,22 @@ class AdminToolshed( AdminGalaxy ): shed_tool_conf = shed_tool_conf.replace( './', '', 1 ) shed_tool_conf_select_field = None tool_panel_section_select_field = build_tool_panel_section_select_field( trans ) + if includes_tools: + # If we're installing a single repository that contains a readme file, get it's contents to display. + decoded_repo_info_dict = tool_shed_decode( repo_info_dict ) + if len( decoded_repo_info_dict ) == 1: + name = decoded_repo_info_dict.keys()[ 0 ] + repo_info_tuple = decoded_repo_info_dict[ name ] + description, repository_clone_url, changeset_revision = repo_info_tuple + owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) ) + url = '%s/repository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % ( tool_shed_url, name, owner, changeset_revision ) + response = urllib2.urlopen( url ) + readme_text = response.read() + response.close() + else: + readme_text = '' + else: + readme_text = '' return trans.fill_template( '/admin/tool_shed_repository/select_tool_panel_section.mako', tool_shed_url=tool_shed_url, repo_info_dict=repo_info_dict, @@ -375,6 +391,7 @@ class AdminToolshed( AdminGalaxy ): shed_tool_conf_select_field=shed_tool_conf_select_field, tool_panel_section_select_field=tool_panel_section_select_field, new_tool_panel_section=new_tool_panel_section, + readme_text=readme_text, message=message, status=status ) @web.expose diff --git a/lib/galaxy/webapps/community/config.py b/lib/galaxy/webapps/community/config.py index 43290136ced..057bae316d2 100644 --- a/lib/galaxy/webapps/community/config.py +++ b/lib/galaxy/webapps/community/config.py @@ -86,6 +86,7 @@ class Configuration( object ): self.cloud_controller_instance = False self.server_name = '' self.job_manager = '' + self.default_job_handlers = [] self.job_handlers = [] self.tool_handlers = [] self.tool_runners = [] diff --git a/lib/galaxy/webapps/community/controllers/repository.py b/lib/galaxy/webapps/community/controllers/repository.py index ebe3a52d6cd..06633c15206 100644 --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -773,6 +773,25 @@ class RepositoryController( BaseUIController, ItemRatings ): ( galaxy_url, url_for( '/', qualified=True ), encoded_repo_info_dict, str( includes_tools ) ) return trans.response.send_redirect( url ) @web.expose + def get_readme( self, trans, **kwd ): + """ + If the received changeset_revision includes a file named readme (case ignored), return it's contents. + """ + name = kwd[ 'name' ] + owner = kwd[ 'owner' ] + changeset_revision = kwd[ 'changeset_revision' ] + repository = get_repository_by_name_and_owner( trans, name, owner ) + repo_dir = repository.repo_path + repo = hg.repository( get_configured_ui(), repo_dir ) + for root, dirs, files in os.walk( repo_dir ): + for name in files: + if name.lower() in [ 'readme', 'read_me' ]: + f = open( os.path.join( root, name ), 'r' ) + text = f.read() + f.close() + return str( text ) + return '' + @web.expose def get_tool_versions( self, trans, **kwd ): """ For each valid /downloadable change set (up to the received changeset_revision) in the diff --git a/templates/admin/tool_shed_repository/select_tool_panel_section.mako b/templates/admin/tool_shed_repository/select_tool_panel_section.mako index 515d5d7d3fc..05e566c3f7b 100644 --- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako @@ -62,3 +62,13 @@ +%if readme_text: +
+
Repository README file (may contain important installation or license information)
+
+
+
${readme_text}
+
+
+
+%endif