| Trees | Indices | Help |
|---|
|
|
1 # -*- Mode: Python -*-
2 # vi:si:et:sw=4:sts=4:ts=4
3 #
4 # Flumotion - a streaming media server
5 # Copyright (C) 2008 Fluendo, S.L. (www.fluendo.com).
6 # All rights reserved.
7
8 # This file may be distributed and/or modified under the terms of
9 # the GNU General Public License version 2 as published by
10 # the Free Software Foundation.
11 # This file is distributed without any warranty; without even the implied
12 # warranty of merchantability or fitness for a particular purpose.
13 # See "LICENSE.GPL" in the source distribution for more information.
14
15 # Licensees having purchased or holding a valid Flumotion Advanced
16 # Streaming Server license may use this file in accordance with the
17 # Flumotion Advanced Streaming Server Commercial License Agreement.
18 # See "LICENSE.Flumotion" in the source distribution for more information.
19
20 # Headers in this file shall remain intact.
21
22 """system information collector and bug reporter"""
23
24 import urllib
25 import webbrowser
26
27 from flumotion.common.common import pathToModuleName
28 from flumotion.common.debug import getVersions
29 from flumotion.common.python import sorted as STUPID_PYCHECKER_sorted
30 from flumotion.configure import configure
31
32 _BUG_COMPONENT = 'flumotion'
33 _BUG_KEYWORDS = 'generated'
34 _BUG_TEMPLATE = """
35 Please describe what you were doing when the crash happened.
36
37 ADD YOUR TEXT HERE
38
39 Collected information from your system:
40
41 * Flumotion version: '''%(version)s'''
42 * Flumotion SVN revision: [source:flumotion/%(branch)s#%(rev)s r%(rev)s]
43 %(extra)s
44 Python Traceback:
45 {{{
46 %(traceback)s
47 }}}
48 """
49 _TRAC_URL = 'https://code.fluendo.com/flumotion/trac'
50
51
53 """I am a class that collects information about the system
54 and reports the information to the Flumotion bug report system.
55 """
56
58 self._baseURL = _TRAC_URL
59 self._component = _BUG_COMPONENT
60 self._keywords = [_BUG_KEYWORDS]
61 self._versions = getVersions()
62
64 retval = {}
65 for filename in filenames:
66 moduleName = pathToModuleName(filename)
67 if not moduleName in self._versions:
68 continue
69 retval[filename] = self._versions[moduleName]
70 return retval
71
73 filenames = self._collectFilenames(filenames)
74
75 extra = ' * Filename revisions:\n'
76 for filename in STUPID_PYCHECKER_sorted(filenames.keys()):
77 rev = filenames[filename]
78 link = '[source:flumotion/%s/%s#%s r%s]' % (
79 configure.branchName, filename, rev, rev)
80 extra += " - %s: %s\n" % (filename, link)
81 return extra
82
84 description = _BUG_TEMPLATE % (
85 dict(extra=self._processFilenames(filenames),
86 branch=configure.branchName,
87 rev=max(self._versions.values()),
88 traceback=traceback,
89 version=configure.version))
90 return description
91
92 # Public API
93
95 """Submits a bug report to trac by opening
96 a web browser
97 @param filenames: filenames visible in traceback
98 @type filenames: list of strings
99 @param description: description of the traceback
100 @type description: string
101 @param summary: summary of the bug report
102 @type summary: string
103 """
104 description = self._processTemplate(filenames, description)
105 params = dict(summary=summary,
106 description=description)
107 if self._keywords:
108 params['keywords'] = ','.join(self._keywords)
109 if self._component:
110 params['component'] = self._component
111
112 data = urllib.urlencode(params)
113 reportURL = "%s/newticket?%s" % (self._baseURL, data, )
114 webbrowser.open_new(reportURL)
115
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sun Sep 13 13:20:16 2009 | http://epydoc.sourceforge.net |