コード例 #1
0
def show_report(number,
                system,
                mirrors,
                http_proxy,
                timeout,
                screen=None,
                queryonly=False,
                title='',
                archived='no',
                mbox_reader_cmd=None):
    from reportbug import debbugs

    ui = screen
    if not ui:
        ui = initialize_urwid_ui()

    sysinfo = debbugs.SYSTEMS[system]
    display_message('Retrieving report #%d from %s bug tracking system...',
                    number,
                    sysinfo['name'],
                    title=title,
                    ui=ui)

    info = debbugs.get_report(number,
                              timeout,
                              system,
                              mirrors=mirrors,
                              http_proxy=http_proxy,
                              archived=archived)
    if not info:
        long_message('Bug report #%d not found.', number, title=title, ui=ui)
        return

    options = dict(o='Ok',
                   d='More details (launch browser)',
                   m='Submit more information',
                   q='Quit')
    valid = 'Odmq'

    while 1:
        (buginfo, bodies) = info
        body = bodies[0]

        r = select_options(body,
                           valid,
                           title=buginfo.subject,
                           ui=ui,
                           help=options)
        ui = None
        if not r or (r == 'o'):
            break
        elif r == 'q':
            return -1
        elif r == 'm':
            return buginfo

        launch_browser(debbugs.get_report_url(system, number, archived))
    return
コード例 #2
0
ファイル: text_ui.py プロジェクト: ch1huizong/scode
def _launch_mbox_reader(mbox_reader_cmd, bts, bugs, number, mirrors, archived,
                        mbox, http_proxy, timeout):
    try:
        number = int(number)
        if number not in bugs and 1 <= number <= len(bugs):
            number = bugs[number - 1]
        reportbug.utils.launch_mbox_reader(
            mbox_reader_cmd,
            debbugs.get_report_url(bts, number, mirrors, archived, mbox),
            http_proxy, timeout)
    except ValueError:
        ewrite('Invalid report number: %s\n', number)
コード例 #3
0
ファイル: text_ui.py プロジェクト: AlarWE/RootFS-RaspberryPI
def _launch_mbox_reader(mbox_reader_cmd, bts, bugs, number, mirrors, archived,
                        mbox, http_proxy, timeout):
    try:
        number = int(number)
        if number not in bugs and 1 <= number <= len(bugs):
            number = bugs[number-1]
        reportbug.utils.launch_mbox_reader(mbox_reader_cmd,
            debbugs.get_report_url(
                bts, number, mirrors, archived, mbox), http_proxy,
            timeout)
    except ValueError:
        ewrite('Invalid report number: %s\n',
               number)
コード例 #4
0
ファイル: urwid_ui.py プロジェクト: AlarWE/RootFS-RaspberryPI
def show_report(number, system, mirrors,
                http_proxy, timeout, screen=None, queryonly=False, title='',
                archived='no', mbox_reader_cmd=None):
    from reportbug import debbugs

    ui = screen
    if not ui:
        ui = initialize_urwid_ui()

    sysinfo = debbugs.SYSTEMS[system]
    display_message('Retrieving report #%d from %s bug tracking system...',
        number, sysinfo['name'], title=title, ui=ui)

    info = debbugs.get_report(number, timeout, system, mirrors=mirrors,
                                http_proxy=http_proxy, archived=archived)
    if not info:
        long_message('Bug report #%d not found.', number, title=title, ui=ui)
        return

    options = dict(o='Ok', d='More details (launch browser)',
                   m='Submit more information', q='Quit')
    valid = 'Odmq'

    while 1:
        (buginfo, bodies) = info
        body = bodies[0]

        r = select_options(body, valid, title=buginfo.subject, ui=ui, help=options)
        ui = None
        if not r or (r == 'o'):
            break
        elif r == 'q':
            return -1
        elif r == 'm':
            return buginfo

        launch_browser(debbugs.get_report_url(system, number, archived))
    return
コード例 #5
0
ファイル: test_debbugs.py プロジェクト: davesteele/reportbug
 def test_get_report_url(self):
     self.assertCountEqual(
         debbugs.get_report_url('debian', 123).split('?')[1].split('&'),
         'bug=123&archived=False&mbox=no'.split('&'))
コード例 #6
0
ファイル: test_debbugs.py プロジェクト: ProgVal/reportbug
    def test_get_report_url(self):

        self.assertEqual(
            debbugs.get_report_url("debian", 123),
            "http://bugs.debian.org/cgi-bin/bugreport.cgi?" + "bug=123&archived=False&mbox=no",
        )
コード例 #7
0
ファイル: text_ui.py プロジェクト: AlarWE/RootFS-RaspberryPI
def show_report(number, system, mirrors,
                http_proxy, timeout, screen=None, queryonly=False, title='',
                archived='no', mbox_reader_cmd=None):
    sysinfo = debbugs.SYSTEMS[system]
    ewrite('Retrieving report #%d from %s bug tracking system...\n',
           number, sysinfo['name'])

    try:
        info = debbugs.get_report(number, timeout, system, mirrors=mirrors,
                                    followups=1,
                                    http_proxy=http_proxy, archived=archived)
    except:
        info = None

    if not info:
        ewrite('No report available: #%s\n', number)
        raise NoBugs

    buginfo, messages = info

    # XXX: could this be ever possible?
    if not (buginfo.package or not buginfo.source):
        ewrite('Cannot retrieve bug\'s package, exiting...\n')
        sys.exit(-1)

    current_message = 0
    skip_pager = False

    while 1:
        if current_message:
            text = 'Followup %d - %s\n\n%s' % (current_message, buginfo.subject,
                                                 messages[current_message])
        else:
            text = 'Original report - %s\n\n%s' % (buginfo.subject, messages[0])

        if not skip_pager:
            fd = os.popen('sensible-pager', 'w')
            try:
                fd.write(text)
                fd.close()
            except IOError, x:
                if x.errno == errno.EPIPE:
                    pass
                else:
                    raise
        skip_pager = False

        options = 'xOrbeq'

        if (current_message+1) < len(messages):
            options = 'N'+options.lower()
        if (current_message):
            options = 'p'+options

        x = select_options("What do you want to do now?", options,
                           {'x' : 'Provide extra information.',
                            'o' : 'Show other bug reports (return to '
                            'bug listing).',
                            'n' : 'Show next message (followup).',
                            'p' : 'Show previous message (followup).',
                            'r' : 'Redisplay this message.',
                            'e' : 'Launch e-mail client to read full log.',
                            'b' : 'Launch web browser to read '
                            'full log.',
                            'q' : "I'm bored; quit please."},
                           allow_numbers = range(1, len(messages)+1))
        if x == 'x':
            return buginfo
        elif x == 'q':
            raise NoReport
        elif x == 'b':
            launch_browser(debbugs.get_report_url(
                system, number, mirrors, archived))
            skip_pager = True
        elif x == 'e':
            reportbug.utils.launch_mbox_reader(mbox_reader_cmd,
                debbugs.get_report_url(
                    system, number, mirrors, archived, True), http_proxy,
                    timeout)
            skip_pager = True
        elif x == 'o':
            break
        elif x == 'n':
            current_message += 1
        elif x == 'p':
            current_message -= 1
コード例 #8
0
ファイル: text_ui.py プロジェクト: ch1huizong/scode
def show_report(number,
                system,
                mirrors,
                http_proxy,
                timeout,
                screen=None,
                queryonly=False,
                title='',
                archived='no',
                mbox_reader_cmd=None):
    sysinfo = debbugs.SYSTEMS[system]
    ewrite('Retrieving report #%d from %s bug tracking system...\n', number,
           sysinfo['name'])

    try:
        info = debbugs.get_report(number,
                                  timeout,
                                  system,
                                  mirrors=mirrors,
                                  followups=1,
                                  http_proxy=http_proxy,
                                  archived=archived)
    except:
        info = None

    if not info:
        ewrite('No report available: #%s\n', number)
        raise NoBugs

    buginfo, messages = info

    # XXX: could this be ever possible?
    if not (buginfo.package or not buginfo.source):
        ewrite('Cannot retrieve bug\'s package, exiting...\n')
        sys.exit(-1)

    current_message = 0
    skip_pager = False

    while 1:
        if current_message:
            text = 'Followup %d - %s\n\n%s' % (
                current_message, buginfo.subject, messages[current_message])
        else:
            text = 'Original report - %s\n\n%s' % (buginfo.subject,
                                                   messages[0])

        if not skip_pager:
            fd = os.popen('sensible-pager', 'w')
            try:
                fd.write(text)
                fd.close()
            except IOError, x:
                if x.errno == errno.EPIPE:
                    pass
                else:
                    raise
        skip_pager = False

        options = 'xOrbeq'

        if (current_message + 1) < len(messages):
            options = 'N' + options.lower()
        if (current_message):
            options = 'p' + options

        x = select_options("What do you want to do now?",
                           options, {
                               'x': 'Provide extra information.',
                               'o': 'Show other bug reports (return to '
                               'bug listing).',
                               'n': 'Show next message (followup).',
                               'p': 'Show previous message (followup).',
                               'r': 'Redisplay this message.',
                               'e': 'Launch e-mail client to read full log.',
                               'b': 'Launch web browser to read '
                               'full log.',
                               'q': "I'm bored; quit please."
                           },
                           allow_numbers=range(1,
                                               len(messages) + 1))
        if x == 'x':
            return buginfo
        elif x == 'q':
            raise NoReport
        elif x == 'b':
            launch_browser(
                debbugs.get_report_url(system, number, mirrors, archived))
            skip_pager = True
        elif x == 'e':
            reportbug.utils.launch_mbox_reader(
                mbox_reader_cmd,
                debbugs.get_report_url(system, number, mirrors, archived,
                                       True), http_proxy, timeout)
            skip_pager = True
        elif x == 'o':
            break
        elif x == 'n':
            current_message += 1
        elif x == 'p':
            current_message -= 1