Exemplo n.º 1
0
def get_description(macro, data, type_):
    # keys
    authors = data.get('authors', 'unknown')
    try:
        if type(authors) != unicode_:
            authors = unicode_(authors, 'utf-8')
    except UnicodeDecodeError:
        authors = ''

    maintainers = data.get('maintainers', '')
    try:
        if type(maintainers) != unicode_:
            maintainers = unicode_(maintainers, 'utf-8')
    except UnicodeDecodeError:
        maintainers = ''

    license = data.get('license', 'unknown')

    description = data.get('description', '')
    try:
        if type(description) != unicode_:
            description = unicode_(description, 'utf-8')
    except UnicodeDecodeError:
        description = ''

    reports_html = get_reports(macro, data)

    f = macro.formatter
    p, li, ul = f.paragraph, f.listitem, f.bullet_list
    h, text, rawHTML = f.heading, f.text, f.rawHTML

    if type_ == 'stack':
        title = 'Stack Summary'
        badges = ''
    else:
        title = 'Package Summary'
        badges = get_badges(macro, data)
    try:
        repo_li = get_repo_li(macro, data)
        vcs_li = get_vcs_li(macro, data)
        bugtracker_li = get_bugtracker_li(macro, data)
        url_li = get_url_li(macro, data)
        maintainers_li = li(1) + text("Maintainer: " + obfuscate_email(
            maintainers)) + li(0) if maintainers else ''
        maintainer_status_li = get_maintainer_status_li(macro, data)

        # id=first for package?
        # desc = h(1, 2, id="summary")+text(title)+h(0, 2)+\
        desc = ("<h1>" + text(title) + "</h1>" + badges +
                p(1, id="package-info") + rawHTML(description) + p(0) +
                p(1, id="package-info") + ul(1) + maintainer_status_li +
                maintainers_li + li(1) +
                text("Author: " + obfuscate_email(authors)) + li(0) + li(1) +
                text("License: " + license) + li(0) + url_li + repo_li +
                bugtracker_li + vcs_li + reports_html + ul(0) + p(0))
    except UnicodeDecodeError:
        desc = h(1, 2) + text(title) + h(
            0, 2) + p(1) + text('Error retrieving ' + title) + p(0)
    return desc
Exemplo n.º 2
0
def get_stack_items(macro, repo_data):
    f = macro.formatter
    p, url, div, br = f.paragraph, f.url, f.div, f.linebreak
    em, strong = f.emphasis, f.strong
    h, li, ul = f.heading, f.listitem, f.bullet_list
    text, rawHTML = f.text, f.rawHTML

    items = []
    vcs_config = repo_data['vcs']
    stacks = repo_data['stacks']
    for name in sorted(stacks.iterkeys()):
        data = stacks[name]
        data['vcs'] = vcs_config['type']

        # keys
        authors = data.get('authors', 'unknown')
        try:
            if type(authors) != unicode:
                authors = unicode(authors, 'utf-8')
        except UnicodeDecodeError:
            authors = ''
        license = data.get('license', 'unknown')
        description = data.get('description', '')
        try:
            if type(description) != unicode:
                description = unicode(description, 'utf-8')
        except UnicodeDecodeError:
            description = ''
        packages = data.get('packages', [])

        # filter out test packages
        packages = [s for s in packages if not s.startswith('test_')]
        packages.sort()

        package_links = []
        for pkg in packages:
            package_links.append(wiki_url(macro, pkg))

        # don't include vcs link for git/bzr/hg/etc... as URI cannot point
        # to stack directly in a DVCS, i.e. it's only useful for SVN
        # stacks.
        if vcs_config['type'] == 'svn':
            vcs_li = get_vcs_li(macro, data)
        else:
            vcs_li = ''
        stack_html = \
            rawHTML('<a name="%s">'%(name))+\
            h(1,3)+rawHTML(wiki_url(macro, name))+h(0,3)+\
            p(1,id="package-info")+rawHTML(description)+p(0)+\
            p(1,id="package-info")+ul(1)+\
            li(1)+text("Author: "+authors)+li(0)+\
            li(1)+text("License: "+license)+li(0)+\
            li(1)+text("Packages: ")+rawHTML(", ".join(package_links))+li(0)+\
            vcs_li+\
            ul(0)+p(0)
        items.append(stack_html)
    return items
Exemplo n.º 3
0
def get_stack_items(macro, repo_data):
    f = macro.formatter
    p, url, div, br = f.paragraph, f.url, f.div, f.linebreak
    em, strong = f.emphasis, f.strong
    h, li, ul = f.heading, f.listitem, f.bullet_list
    text, rawHTML = f.text, f.rawHTML
    
    items = []
    vcs_config = repo_data['vcs']
    stacks = repo_data['stacks']
    for name in sorted(stacks.iterkeys()):
        data = stacks[name]
        data['vcs'] = vcs_config['type']
  
        # keys
        authors = data.get('authors', 'unknown')
        try:
            if type(authors) != unicode:
                authors = unicode(authors, 'utf-8')
        except UnicodeDecodeError:
            authors = ''
        license = data.get('license', 'unknown')
        description = data.get('description', '')
        try:
            if type(description) != unicode:
                description = unicode(description, 'utf-8')
        except UnicodeDecodeError:
            description = ''
        packages = data.get('packages', [])
  
        # filter out test packages
        packages = [s for s in packages if not s.startswith('test_')]
        packages.sort()
  
        package_links = []
        for pkg in packages:
            package_links.append(wiki_url(macro, pkg))
  
        # don't include vcs link for git/bzr/hg/etc... as URI cannot point
        # to stack directly in a DVCS, i.e. it's only useful for SVN
        # stacks.
        if vcs_config['type'] == 'svn':
            vcs_li = get_vcs_li(macro, data)
        else:
            vcs_li = ''
        stack_html = \
            rawHTML('<a name="%s">'%(name))+\
            h(1,3)+rawHTML(wiki_url(macro, name))+h(0,3)+\
            p(1,id="package-info")+rawHTML(description)+p(0)+\
            p(1,id="package-info")+ul(1)+\
            li(1)+text("Author: "+authors)+li(0)+\
            li(1)+text("License: "+license)+li(0)+\
            li(1)+text("Packages: ")+rawHTML(", ".join(package_links))+li(0)+\
            vcs_li+\
            ul(0)+p(0)
        items.append(stack_html)
    return items
Exemplo n.º 4
0
def get_description(macro, data, type_):
    # keys
    authors = data.get('authors', 'unknown')
    try:
      if type(authors) != unicode:
        authors = unicode(authors, 'utf-8')
    except UnicodeDecodeError:
      authors = ''

    maintainers = data.get('maintainers', '')
    try:
      if type(maintainers) != unicode:
        maintainers = unicode(maintainers, 'utf-8')
    except UnicodeDecodeError:
      maintainers = ''

    license = data.get('license', 'unknown')

    description = data.get('description', '')
    try:
        if type(description) != unicode:
            description = unicode(description, 'utf-8')
    except UnicodeDecodeError:
        description = ''

    f = macro.formatter
    p, div, li, ul = f.paragraph, f.div, f.listitem, f.bullet_list
    h, text, rawHTML = f.heading, f.text, f.rawHTML

    if type_ == 'stack':
        title = 'Stack Summary'
    else:
        title = 'Package Summary'
    try:
        repo_li = get_repo_li(macro, data)
        vcs_li = get_vcs_li(macro, data)
        bugtracker_li = get_bugtracker_li(macro, data)
        url_li = get_url_li(macro, data)
        maintainers_li = li(1)+text("Maintainer: "+maintainers)+li(0) if maintainers else ''

        # id=first for package?
        #desc = h(1, 2, id="summary")+text(title)+h(0, 2)+\
        desc = "<h1>"+text(title)+"</h1>"+\
               p(1,id="package-info")+rawHTML(description)+p(0)+\
               p(1,id="package-info")+ul(1)+\
               maintainers_li+\
               li(1)+text("Author: "+authors)+li(0)+\
               li(1)+text("License: "+license)+li(0)+\
               url_li+\
               repo_li+\
               bugtracker_li+\
               vcs_li+\
               ul(0)+p(0)
    except UnicodeDecodeError:
        desc = h(1, 2)+text(title)+h(0,2)+p(1)+text('Error retrieving '+title)+p(0)
    return desc
Exemplo n.º 5
0
        packages = data.get("packages", [])

        # filter out test packages
        packages = [s for s in packages if not s.startswith("test_")]
        packages.sort()

        package_links = []
        for pkg in packages:
            package_links.append(wiki_url(macro, pkg))

        # don't include vcs link for git/bzr/hg/etc... as URI cannot point
        # to stack directly in a DVCS, i.e. it's only useful for SVN
        # stacks.
        if vcs_config["type"] == "svn":
            # we strip this redundant tag from the stack data and have to reinsert
            vcs_li = get_vcs_li(macro, data)
        else:
            vcs_li = ""
        stack_html = (
            rawHTML('<a name="%s">' % (stack_name))
            + h(1, 3)
            + rawHTML(wiki_url(macro, stack_name))
            + h(0, 3)
            + p(1, id="package-info")
            + rawHTML(description)
            + p(0)
            + p(1, id="package-info")
            + ul(1)
            + li(1)
            + text("Author: " + authors)
            + li(0)
Exemplo n.º 6
0
        packages = data.get('packages', [])

        # filter out test packages
        packages = [s for s in packages if not s.startswith('test_')]
        packages.sort()

        package_links = []
        for pkg in packages:
            package_links.append(wiki_url(macro, pkg))

        # don't include vcs link for git/bzr/hg/etc... as URI cannot point
        # to stack directly in a DVCS, i.e. it's only useful for SVN
        # stacks.
        if vcs_config['type'] == 'svn':
            # we strip this redundant tag from the stack data and have to reinsert
            vcs_li = get_vcs_li(macro, data)
        else:
            vcs_li = ''
        stack_html = \
            rawHTML('<a name="%s">'%(stack_name))+\
            h(1,3)+rawHTML(wiki_url(macro, stack_name))+h(0,3)+\
            p(1,id="package-info")+rawHTML(description)+p(0)+\
            p(1,id="package-info")+ul(1)+\
            li(1)+text("Author: "+authors)+li(0)+\
            li(1)+text("License: "+license)+li(0)+\
            li(1)+text("Packages: ")+rawHTML(", ".join(package_links))+li(0)+\
            vcs_li+\
            ul(0)+p(0)
        stack_items.append(stack_html)

    toc = ul(1)
Exemplo n.º 7
0
def get_description(macro, data, type_):
    # keys
    authors = data.get("authors", "unknown")
    try:
        if type(authors) != unicode:
            authors = unicode(authors, "utf-8")
    except UnicodeDecodeError:
        authors = ""

    maintainers = data.get("maintainers", "")
    try:
        if type(maintainers) != unicode:
            maintainers = unicode(maintainers, "utf-8")
    except UnicodeDecodeError:
        maintainers = ""

    license = data.get("license", "unknown")

    description = data.get("description", "")
    try:
        if type(description) != unicode:
            description = unicode(description, "utf-8")
    except UnicodeDecodeError:
        description = ""

    f = macro.formatter
    p, div, li, ul = f.paragraph, f.div, f.listitem, f.bullet_list
    h, text, rawHTML = f.heading, f.text, f.rawHTML

    if type_ == "stack":
        title = "Stack Summary"
    else:
        title = "Package Summary"
    try:
        repo_li = get_repo_li(macro, data)
        vcs_li = get_vcs_li(macro, data)
        bugtracker_li = get_bugtracker_li(macro, data)
        url_li = get_url_li(macro, data)
        maintainers_li = li(1) + text("Maintainer: " + maintainers) + li(0) if maintainers else ""

        # id=first for package?
        # desc = h(1, 2, id="summary")+text(title)+h(0, 2)+\
        desc = (
            "<h1>"
            + text(title)
            + "</h1>"
            + p(1, id="package-info")
            + rawHTML(description)
            + p(0)
            + p(1, id="package-info")
            + ul(1)
            + maintainers_li
            + li(1)
            + text("Author: " + authors)
            + li(0)
            + li(1)
            + text("License: " + license)
            + li(0)
            + url_li
            + repo_li
            + bugtracker_li
            + vcs_li
            + ul(0)
            + p(0)
        )
    except UnicodeDecodeError:
        desc = h(1, 2) + text(title) + h(0, 2) + p(1) + text("Error retrieving " + title) + p(0)
    return desc