Esempio n. 1
0
def macro_PackageHeader(macro, arg1, arg2=None):
    package_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(package_name, distro_names)
        for distro in distro_names:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                pkg_header_html = generate_old_package_header(
                    macro, package_name, distro)
            else:
                pkg_header_html = generate_package_header(
                    macro, package_name, distro)
            headers_html.append('<div class="version %s">' % distro +
                                pkg_header_html + '</div>')

        html = "\n".join([
            distro_html(distro, loaded_distros) for distro in distro_names
        ]) + doc_html(distro_names, package_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_package_header(macro, package_name, opt_distro)
        else:
            return generate_package_header(macro, package_name, opt_distro)
Esempio n. 2
0
def macro_StackHeader(macro, arg1, arg2=None):
    stack_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if ' ' in stack_name:
        #something changed in the API such that the above arg1, arg2 passing no longer works
        splits = stack_name.split(' ')
        if len(splits) > 2:
            return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"
        stack_name, lang = splits
    if not stack_name:
        return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"

    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(stack_name, distro_names)
        for distro in distro_names:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                stack_header_html = generate_old_stack_header(macro, stack_name, distro)
            else:
                stack_header_html = generate_package_header(macro, stack_name, distro)
            headers_html.append('<div class="version %s">' % distro + stack_header_html + '</div>')

        html = '<span id="rosversion_selector" class="btn-group">\n'
        html += "\n".join([distro_html(distro, loaded_distros) for distro in distro_names])
        html += '\n</span>'
        html += doc_html(distro_names, stack_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_stack_header(macro, stack_name, opt_distro)
        else:
            return generate_package_header(macro, stack_name, opt_distro)
Esempio n. 3
0
def macro_StackHeader(macro, arg1, arg2=None):
    stack_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if ' ' in stack_name:
        #something changed in the API such that the above arg1, arg2 passing no longer works
        splits = stack_name.split(' ')
        if len(splits) > 2:
            return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"
        stack_name, lang = splits
    if not stack_name:
        return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"

    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(stack_name, distro_names)
        for distro in distro_names:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                stack_header_html = generate_old_stack_header(macro, stack_name, distro)
            else:
                stack_header_html = generate_package_header(macro, stack_name, distro)
            headers_html.append('<div class="version %s">' % distro + stack_header_html + '</div>')

        html = "\n".join([distro_html(distro, loaded_distros) for distro in distro_names]) + doc_html(distro_names, stack_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_stack_header(macro, stack_name, opt_distro)
        else:
            return generate_package_header(macro, stack_name, opt_distro)
Esempio n. 4
0
def macro_StackHeader(macro, arg1, arg2=None):
    stack_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if ' ' in stack_name:
        #something changed in the API such that the above arg1, arg2 passing no longer works
        splits = stack_name.split(' ')
        if len(splits) > 2:
            return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"
        stack_name, lang = splits
    if not stack_name:
        return "ERROR in StackHeader. Usage: [[StackHeader(pkg_name opt_lang)]]"

    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(stack_name, distro_names_buildfarm)
        loaded_distros_eol = [
            distro for distro in loaded_distros if distro in distro_names_eol
        ]
        loaded_distros_buildfarm = [
            distro for distro in loaded_distros
            if distro in distro_names_buildfarm
        ]
        for distro in loaded_distros:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                stack_header_html = generate_old_stack_header(
                    macro, stack_name, distro)
            else:
                stack_header_html = generate_package_header(
                    macro, stack_name, distro)
            headers_html.append('<div class="version %s">' % distro +
                                stack_header_html + '</div>')

        html = ''
        if loaded_distros_buildfarm:
            if loaded_distros_eol:
                html += distro_selector_with_eol_toggle_html(
                    distros_displayed_by_default=loaded_distros_buildfarm,
                    distros_hidden_by_default=loaded_distros_eol,
                )
            else:
                # Only active distros available: don't show EOL toggle.
                html += distro_selector_html(
                    distros_displayed=loaded_distros_buildfarm, )
        else:
            if loaded_distros_eol:
                # Only EOL distros available: don't show EOL toggle.
                html += ('<span style="text-align:left">'
                         '<i>Only released in EOL distros:</i>'
                         '&nbsp;&nbsp;'
                         '</span>')
                html += distro_selector_html(
                    distros_displayed=loaded_distros_eol, )
        html += doc_html(loaded_distros, stack_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_stack_header(macro, stack_name, opt_distro)
        else:
            return generate_package_header(macro, stack_name, opt_distro)
Esempio n. 5
0
def macro_PackageHeader(macro, arg1, arg2=None):
    package_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(package_name, distro_names)
        loaded_distros_eol = [
            distro for distro in loaded_distros if distro in distro_names_eol
        ]
        loaded_distros_buildfarm = [
            distro for distro in loaded_distros
            if distro in distro_names_buildfarm
        ]
        for distro in loaded_distros:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                pkg_header_html = generate_old_package_header(
                    macro, package_name, distro)
            else:
                pkg_header_html = generate_package_header(
                    macro, package_name, distro)
            headers_html.append('<div class="version %s">' % distro +
                                pkg_header_html + '</div>')

        html = ''
        if loaded_distros_buildfarm:
            if loaded_distros_eol:
                html += distro_selector_with_eol_toggle_html(
                    distros_displayed_by_default=loaded_distros_buildfarm,
                    distros_hidden_by_default=loaded_distros_eol,
                )
            else:
                # Only active distros available: don't show EOL toggle.
                html += distro_selector_html(
                    distros_displayed=loaded_distros_buildfarm, )
        else:
            if loaded_distros_eol:
                # Only EOL distros available: don't show EOL toggle.
                html += ('<span style="text-align:left">'
                         '<i>Only released in EOL distros:</i>'
                         '&nbsp;&nbsp;'
                         '</span>')
                html += distro_selector_html(
                    distros_displayed=loaded_distros_eol, )
        html += doc_html(loaded_distros, package_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_package_header(macro, package_name, opt_distro)
        else:
            return generate_package_header(macro, package_name, opt_distro)
Esempio n. 6
0
def macro_PackageHeader(macro, arg1, arg2=None):
    package_name = get_unicode(macro.request, arg1)
    opt_distro = get_unicode(macro.request, arg2)
    if not opt_distro:
        headers_html = []
        loaded_distros = get_loaded_distros(package_name, distro_names)
        for distro in distro_names:
            if distro in ['boxturtle', 'cturtle', 'diamondback']:
                pkg_header_html = generate_old_package_header(macro, package_name, distro)
            else:
                pkg_header_html = generate_package_header(macro, package_name, distro)
            headers_html.append('<div class="version %s">' % distro + pkg_header_html + '</div>')

        html = "\n".join([distro_html(distro, loaded_distros) for distro in distro_names]) + doc_html(distro_names, package_name)
        return macro.formatter.rawHTML(html + "\n".join(headers_html))
    else:
        if opt_distro in ['boxturtle', 'cturtle', 'diamondback']:
            return generate_old_package_header(macro, package_name, opt_distro)
        else:
            return generate_package_header(macro, package_name, opt_distro)