/
report.py
145 lines (121 loc) · 3.57 KB
/
report.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
'''
Report tool
===========
This tool is an helper for user. It will be used to dump all informations
for helping in debugging process.
'''
import os
import sys
import time
from ConfigParser import ConfigParser
from StringIO import StringIO
from xmlrpclib import ServerProxy
import kivy
report = []
def title(t):
report.append('')
report.append('=' * 80)
report.append(t)
report.append('=' * 80)
report.append('')
# ----------------------------------------------------------
# Start output debugging
# ----------------------------------------------------------
title('Global')
report.append('OS platform : %s' % sys.platform)
report.append('Python EXE : %s' % sys.executable)
report.append('Python Version : %s' % sys.version)
report.append('Python API : %s' % sys.api_version)
report.append('Kivy Version : %s' % kivy.__version__)
report.append('Install path : %s' % os.path.dirname(kivy.__file__))
report.append('Install date : %s' % time.ctime(os.path.getctime(kivy.__file__)))
title('OpenGL')
from kivy.core import gl
from kivy.core.window import Window
report.append('GL Vendor: %s' % gl.glGetString(gl.GL_VENDOR))
report.append('GL Renderer: %s' % gl.glGetString(gl.GL_RENDERER))
report.append('GL Version: %s' % gl.glGetString(gl.GL_VERSION))
ext = gl.glGetString(gl.GL_EXTENSIONS)
if ext is None:
report.append('GL Extensions: %s' % ext)
else:
report.append('GL Extensions:')
for x in ext.split():
report.append('\t%s' % x)
Window.close()
title('Core selection')
from kivy.core.audio import SoundLoader
report.append('Audio = %s' % SoundLoader._classes)
from kivy.core.camera import Camera
report.append('Camera = %s' % Camera)
from kivy.core.image import ImageLoader
report.append('Image = %s' % ImageLoader.loaders)
from kivy.core.text import Label
report.append('Text = %s' % Label)
from kivy.core.video import Video
report.append('Video = %s' % Video)
report.append('Window = %s' % Window)
title('Libraries')
def testimport(libname):
try:
l = __import__(libname)
report.append('%-20s exist at %s' % (libname, l.__file__))
except ImportError, e:
report.append('%-20s is missing' % libname)
for x in (
'gst',
'pygame',
'pygame.midi',
'pyglet',
'videocapture',
'squirtle',
'PIL',
'cairo',
'opencv',
'opencv.cv',
'opencv.highgui',
'cython',
):
testimport(x)
title('Configuration')
s = StringIO()
from kivy.config import Config
ConfigParser.write(Config, s)
report.extend(s.getvalue().split('\n'))
title('Input availability')
from kivy.input.factory import MotionEventFactory
for x in MotionEventFactory.list():
report.append(x)
'''
title('Log')
for x in pymt_logger_history.history:
report.append(x.message)
'''
title('Environ')
for k, v in os.environ.iteritems():
report.append('%s = %s' % (k, v))
title('Options')
for k, v in kivy.kivy_options.iteritems():
report.append('%s = %s' % (k, v))
report = '\n'.join(report)
print report
print
print
try:
reply = raw_input('Do you accept to send report to paste.pocoo.org (Y/n) : ')
except EOFError:
sys.exit(0)
if reply.lower().strip() in ('', 'y'):
print 'Please wait while sending the report...'
s = ServerProxy('http://paste.pocoo.org/xmlrpc/')
r = s.pastes.newPaste('text', report)
print
print
print 'REPORT posted at http://paste.pocoo.org/show/%s/' % r
print
print
else:
print 'No report posted.'
# On windows system, the console leave directly after the end
# of the dump. That's not cool if we want get report url
raw_input('Enter any key to leave.')