Exemplo n.º 1
0
def get_repo_info_dicts( trans, tool_shed_url, repository_id, changeset_revision ):
    repository = suc.get_repository_in_tool_shed( trans, repository_id )
    repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
    # Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
    repository_dependencies = \
        repository_dependency_util.get_repository_dependencies_for_changeset_revision( trans=trans,
                                                                                       repository=repository,
                                                                                       repository_metadata=repository_metadata,
                                                                                       toolshed_base_url=str( web.url_for( '/', qualified=True ) ).rstrip( '/' ),
                                                                                       key_rd_dicts_to_be_processed=None,
                                                                                       all_repository_dependencies=None,
                                                                                       handled_key_rd_dicts=None )
    repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) )
    ctx = suc.get_changectx_for_changeset( repo, changeset_revision )
    repo_info_dict = {}
    # Cast unicode to string.
    repo_info_dict[ str( repository.name ) ] = ( str( repository.description ),
                                                 suc.generate_clone_url_for_repository_in_tool_shed( trans, repository ),
                                                 str( changeset_revision ),
                                                 str( ctx.rev() ),
                                                 str( repository.user.username ),
                                                 repository_dependencies,
                                                 None )
    all_required_repo_info_dict = common_install_util.get_required_repo_info_dicts( trans, tool_shed_url, [ repo_info_dict ] )
    all_repo_info_dicts = all_required_repo_info_dict.get( 'all_repo_info_dicts', [] )
    return all_repo_info_dicts
Exemplo n.º 2
0
                                lock.release()
                        if readme_file_name.endswith( '.rst' ):
                            text_of_reasonable_length = Template( rst_to_html( text_of_reasonable_length ),
                                                                  input_encoding='utf-8',
                                                                  output_encoding='utf-8',
                                                                  default_filters=[ 'decode.utf8' ],
                                                                  encoding_errors='replace' )
                            text_of_reasonable_length = text_of_reasonable_length.render( static_path=web.url_for( '/static' ),
                                                                                          host_url=web.url_for( '/', qualified=True ) )
                            text_of_reasonable_length = unicodify( text_of_reasonable_length )
                        else:
                            text_of_reasonable_length = suc.to_html_string( text_of_reasonable_length )
                        readme_files_dict[ readme_file_name ] = text_of_reasonable_length
                else:
                    # We must be in the tool shed and have an old changeset_revision, so we need to retrieve the file contents from the repository manifest.
                    ctx = suc.get_changectx_for_changeset( repo, changeset_revision )
                    if ctx:
                        fctx = suc.get_file_context_from_ctx( ctx, readme_file_name )
                        if fctx and fctx not in [ 'DELETED' ]:
                            try:
                                text = unicodify( fctx.data() )
                                readme_files_dict[ readme_file_name ] = suc.size_string( text )
                            except Exception, e:
                                log.exception( "Error reading README file '%s' from repository manifest: %s" % \
                                               ( str( relative_path_to_readme_file ), str( e ) ) )
    return readme_files_dict

def get_readme_files_dict_for_display( trans, tool_shed_url, repo_info_dict ):
    """
    Return a dictionary of README files contained in the single repository being installed so they can be displayed on the tool panel section
    selection page.
Exemplo n.º 3
0
 def get_value( self, trans, grid, repository_metadata ):
     repository = repository_metadata.repository
     repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) )
     ctx = suc.get_changectx_for_changeset( repo, repository_metadata.changeset_revision )
     return "%s:%s" % ( str( ctx.rev() ), repository_metadata.changeset_revision )
Exemplo n.º 4
0
 def get_value( self, trans, grid, repository_metadata ):
     repository = repository_metadata.repository
     repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) )
     ctx = suc.get_changectx_for_changeset( repo, repository_metadata.changeset_revision )
     return suc.get_revision_label( trans, repository, repository_metadata.changeset_revision, include_date=True )