Exemplo n.º 1
0
def human(pkgsinfo, newer_only=False, limit=None, show_requiredby=False):
    color_init()
    sys.stderr.write('\nReport for humans\n\n')
    data = builder(pkgsinfo, newer_only=newer_only, limit=limit)
    termx, termy = get_terminal_size()
    for name, record in data.items():
        print(color_by_state(record['state']) + name)
        for version in record['versions']:
            print(
                ' ' * 4 +
                color_by_state(version['state']) +
                version['version'] +
                dots(version['version'], pkgsinfo['ver_maxlen']) +
                ' ' + color_by_state(version['state']) +
                version['state'][0] + ' ' + version['description']
            )
        if show_requiredby and record.get('required_by', False):
            req = ' '.join(sorted(record.get('required_by')))
            indent = (pkgsinfo['ver_maxlen']+5)*' ' + 'R '
            print(
                color_dimmed() +
                textwrap.fill(
                    req,
                    termx - pkgsinfo['ver_maxlen'],
                    initial_indent=indent,
                    subsequent_indent=indent,
                )
            )
Exemplo n.º 2
0
def human(
    pkgsinfo,
    newer_only=False,
    newer_orphaned_only=False,
    limit=None,
    exclude_cfgs=[],
    show_requiredby=False,
):
    color_init()
    sys.stderr.write("\nReport for humans\n\n")
    data = builder(
        pkgsinfo,
        newer_only=newer_only,
        newer_orphaned_only=newer_orphaned_only,
        exclude_cfgs=exclude_cfgs,
        limit=limit,
    )
    termx, termy = get_terminal_size()
    for name, record in data.items():
        print(color_by_state(record["state"]) + name)
        for version in record["versions"]:
            print(
                " " * 4
                + color_by_state(version["state"])
                + version["version"]
                + dots(version["version"], pkgsinfo["ver_maxlen"])
                + " "
                + color_by_state(version["state"])
                + version["state"][0]
                if version["state"]
                else "" + " " + version["description"]
            )
            if version.get("annotation", None):
                indent = (pkgsinfo["ver_maxlen"] + 5) * " " + "a "
                print(
                    color_dimmed()
                    + textwrap.fill(
                        version["annotation"],
                        termx - pkgsinfo["ver_maxlen"],
                        initial_indent=indent,
                        subsequent_indent=indent,
                    )
                )

        if show_requiredby and record.get("required_by", False):
            req = " ".join(sorted(record.get("required_by")))
            indent = (pkgsinfo["ver_maxlen"] + 5) * " " + "r "
            print(
                color_dimmed()
                + textwrap.fill(
                    req,
                    termx - pkgsinfo["ver_maxlen"],
                    initial_indent=indent,
                    subsequent_indent=indent,
                )
            )
Exemplo n.º 3
0
def browser(
    pkgsinfo,
    newer_only=False,
    newer_orphaned_only=False,
    limit=None,
    show_requiredby=False
):
    color_init()
    sys.stderr.write('\nReport for brower\n\n')
    data = builder(
        pkgsinfo,
        newer_only=newer_only,
        newer_orphaned_only=newer_orphaned_only,
        limit=limit
    )
    template = jenv.get_template('browser.jinja')
    print(template.render(data=data, req_by=show_requiredby))
Exemplo n.º 4
0
def browser(pkgsinfo,
            newer_only=False,
            newer_orphaned_only=False,
            limit=None,
            show_requiredby=False,
            show_release_dates=False,
            file=sys.stdout):
    color_init()
    sys.stderr.write('\nReport for browsers\n\n')
    data = builder(pkgsinfo,
                   newer_only=newer_only,
                   newer_orphaned_only=newer_orphaned_only,
                   limit=limit)
    template = jenv.get_template('browser.jinja')
    print(template.render(
        data=data,
        req_by=show_requiredby,
        rel_date=show_release_dates,
    ),
          file=file)
Exemplo n.º 5
0
def human(pkgsinfo, newer_only=False, limit=None, show_requiredby=False):
    color_init()
    sys.stderr.write('\nReport for humans\n\n')
    data = builder(pkgsinfo, newer_only=newer_only, limit=limit)
    termx, termy = get_terminal_size()
    for name, record in data.items():
        print(color_by_state(record['state']) + name)
        for version in record['versions']:
            print(' ' * 4 + color_by_state(version['state']) +
                  version['version'] +
                  dots(version['version'], pkgsinfo['ver_maxlen']) + ' ' +
                  color_by_state(version['state']) + version['state'][0] +
                  ' ' + version['description'])
        if show_requiredby and record.get('required_by', False):
            req = ' '.join(sorted(record.get('required_by')))
            indent = (pkgsinfo['ver_maxlen'] + 5) * ' ' + 'R '
            print(color_dimmed() + textwrap.fill(
                req,
                termx - pkgsinfo['ver_maxlen'],
                initial_indent=indent,
                subsequent_indent=indent,
            ))
Exemplo n.º 6
0
def browser(
    pkgsinfo,
    newer_only=False,
    newer_orphaned_only=False,
    limit=None,
    exclude_cfgs=[],
    show_requiredby=False,
    show_release_dates=False,
    file=sys.stdout,
):
    color_init()
    sys.stderr.write("\nReport for browsers\n\n")
    data = builder(
        pkgsinfo,
        newer_only=newer_only,
        newer_orphaned_only=newer_orphaned_only,
        exclude_cfgs=exclude_cfgs,
        limit=limit,
    )
    template = jenv.get_template("browser.jinja")
    print(
        template.render(data=data, req_by=show_requiredby, rel_date=show_release_dates),
        file=file,
    )
Exemplo n.º 7
0
def browser(pkgsinfo, newer_only=False, limit=None, show_requiredby=False):
    color_init()
    sys.stderr.write('\nReport for brower\n\n')
    data = builder(pkgsinfo, newer_only=newer_only, limit=limit)
    template = jenv.get_template('browser.jinja')
    print(template.render(data=data, req_by=show_requiredby))