~blueyed/apport/bug532944-lucid

« back to all changes in this revision

Viewing changes to apport/ui.py

  • Committer: Martin Pitt
  • Date: 2009-06-26 08:41:37 UTC
  • mfrom: (1369.1.111 trunk)
  • Revision ID: martin.pitt@canonical.com-20090626084137-htg4q8ftjcs29ll5
* New upstream release. Compared to our previous snapshot, this changes:
  - Replace Qt4 frontend with KDE frontend, thanks to Richard Johnson!
  - apport/ui.py, run_report_bug(): Clean up PID information collection.
  - gtk/apport-gtk.ui: Drop invalid icon reference. (LP: #389064)
  - ui.py: Do not reject non-distro package reports if report sets CrashDB
    (for third-party destination). (LP: #391015)
  - bin/kernel_crashdump: Use packaging API properly.
  - apport-gtk.ui: Drop erroneous translatable flag from stock buttons.
  - Update German translations.
* debian/*: qt → kde, add transitional package for apport-qt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
            report['Title'] = title
51
51
 
52
52
    # check package origin
53
 
    if 'Package' not in report or \
54
 
        not apport.packaging.is_distro_package(report['Package'].split()[0]):
 
53
    if ('Package' not in report or \
 
54
          not apport.packaging.is_distro_package(report['Package'].split()[0])) \
 
55
          and 'CrashDB' not in report:
55
56
        if 'APPORT_REPORT_THIRDPARTY' in os.environ or \
56
57
            apport.fileutils.get_config('main', 'thirdparty', False, bool=True):
57
58
            report['ThirdParty'] = 'True'
262
263
        '''Report a bug.
263
264
 
264
265
        If a pid is given on the command line, the report will contain runtime
265
 
        debug information. Either a package or a pid must be specified.'''
266
 
 
 
266
        debug information. Either a package or a pid must be specified.
 
267
        '''
267
268
        if not self.options.package and not self.options.pid:
268
269
            self.ui_error_message(_('No package specified'), 
269
270
                _('You need to specify a package or a PID. See --help for more information.'))
270
271
            return False
271
272
        self.report = apport.Report('Bug')
272
 
        try:
273
 
            if self.options.pid:
 
273
 
 
274
        # if PID is given, add info
 
275
        if self.options.pid:
 
276
            try:
274
277
                self.report.add_proc_info(self.options.pid)
275
 
            else:
276
 
                self.report.add_proc_environ()
277
 
        except ValueError:
278
 
                self.ui_error_message(_('Invalid PID'), 
279
 
                    _('The specified process ID does not belong to a program.'))
280
 
                return False
281
 
        except OSError, e:
282
 
            # silently ignore nonexisting PIDs; the user must not close the
283
 
            # application prematurely
284
 
            if e.errno == errno.ENOENT:
285
 
                return False
286
 
            elif e.errno == errno.EACCES:
287
 
                self.ui_error_message(_('Permission denied'), 
288
 
                    _('The specified process does not belong to you. Please run this program as the process owner or as root.'))
289
 
                return False
290
 
            else:
291
 
                raise
 
278
            except ValueError:
 
279
                    self.ui_error_message(_('Invalid PID'), 
 
280
                        _('The specified process ID does not belong to a program.'))
 
281
                    return False
 
282
            except OSError, e:
 
283
                # silently ignore nonexisting PIDs; the user must not close the
 
284
                # application prematurely
 
285
                if e.errno == errno.ENOENT:
 
286
                    return False
 
287
                elif e.errno == errno.EACCES:
 
288
                    self.ui_error_message(_('Permission denied'), 
 
289
                        _('The specified process does not belong to you. Please run this program as the process owner or as root.'))
 
290
                    return False
 
291
                else:
 
292
                    raise
 
293
        else:
 
294
            self.report.add_proc_environ()
 
295
 
292
296
        if self.options.package:
293
297
            self.options.package = self.options.package.strip()
294
298
        # "Do what I mean" for filing against "linux"