| 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.configure import configure
30
31 _BUG_COMPONENT = 'flumotion'
32 _BUG_KEYWORDS = 'generated'
33 _BUG_TEMPLATE = """
34 Please describe what you were doing when the crash happened.
35
36 ADD YOUR TEXT HERE
37
38 Collected information from your system:
39
40 * Flumotion version: '''%(version)s'''
41 * Flumotion SVN revision: [source:flumotion/%(branch)s#%(rev)s r%(rev)s]
42 %(extra)s
43 Python Traceback:
44 {{{
45 %(traceback)s
46 }}}
47 """
48 _TRAC_URL = 'https://code.fluendo.com/flumotion/trac'
49
50
52 """I am a class that collects information about the system
53 and reports the information to the Flumotion bug report system.
54 """
55
57 self._baseURL = _TRAC_URL
58 self._component = _BUG_COMPONENT
59 self._keywords = [_BUG_KEYWORDS]
60 self._versions = getVersions()
61
63 retval = {}
64 for filename in filenames:
65 moduleName = pathToModuleName(filename)
66 if not moduleName in self._versions:
67 continue
68 retval[filename] = self._versions[moduleName]
69 return retval
70
72 filenames = self._collectFilenames(filenames)
73
74 extra = ' * Filename revisions:\n'
75 for filename in sorted(filenames.keys()):
76 rev = filenames[filename]
77 link = '[source:flumotion/%s/%s#%s r%s]' % (
78 configure.branchName, filename, rev, rev)
79 extra += " - %s: %s\n" % (filename, link)
80 return extra
81
83 description = _BUG_TEMPLATE % (
84 dict(extra=self._processFilenames(filenames),
85 branch=configure.branchName,
86 rev=max(self._versions.values()),
87 traceback=traceback,
88 version=configure.version))
89 return description
90
91 # Public API
92
94 """Submits a bug report to trac by opening
95 a web browser
96 @param filenames: filenames visible in traceback
97 @type filenames: list of strings
98 @param description: description of the traceback
99 @type description: string
100 @param summary: summary of the bug report
101 @type summary: string
102 """
103 description = self._processTemplate(filenames, description)
104 params = dict(summary=summary,
105 description=description)
106 if self._keywords:
107 params['keywords'] = ','.join(self._keywords)
108 if self._component:
109 params['component'] = self._component
110
111 data = urllib.urlencode(params)
112 reportURL = "%s/newticket?%s" % (self._baseURL, data, )
113 webbrowser.open_new(reportURL)
114
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Fri Sep 24 12:50:57 2010 | http://epydoc.sourceforge.net |