/usr/share/pyshared/pymt/tools/dump.py is in python-pymt 0.5.1-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | '''
Dump tool to have a possibility to log all what we want from user
If they have any troubles with debugging.
Missing:
compilation support
acceleration support
'''
import os
import sys
import time
from ConfigParser import ConfigParser
from StringIO import StringIO
from xmlrpclib import ServerProxy
import OpenGL
from OpenGL.GL import *
os.environ['PYMT_SHADOW_WINDOW'] = '0'
import pymt
from pymt import *
from pymt.logger import pymt_logger_history
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('PyMT Version : %s' % pymt.__version__)
report.append('Install path : %s' % os.path.dirname(pymt.__file__))
report.append('Install date : %s' % time.ctime(os.path.getctime(pymt.__file__)))
title('OpenGL')
w = MTWindow()
report.append('PyOpenGL Version: %s' % OpenGL.__version__)
report.append('GL Vendor: %s' % glGetString(GL_VENDOR))
report.append('GL Renderer: %s' % glGetString(GL_RENDERER))
report.append('GL Version: %s' % glGetString(GL_VERSION))
ext = glGetString(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)
w.close()
title('Libraries')
def testimport(libname):
try:
l = __import__(libname)
report.append('%-20s exist' % libname)
except ImportError, e:
report.append('%-20s is missing' % libname)
for x in (
'gst',
'pygame',
'pygame.midi',
'numpy',
'OpenGL',
'OpenGL.GL',
'OpenGL.GLU',
'pymt.ext.accelerate',
'pyglet',
'videocapture',
'squirtle',
'PIL',
'cairo',
'opencv',
'opencv.cv',
'opencv.highgui',
):
testimport(x)
title('Core selection')
report.append('Audio = %s' % SoundLoader._classes)
report.append('Camera = %s' % Camera)
report.append('Image = %s' % ImageLoader.loaders)
report.append('Text = %s' % Label)
report.append('Video = %s' % Video)
report.append('Window = %s' % MTWindow)
title('Configuration')
s = StringIO()
ConfigParser.write(pymt_config, s)
report.extend(s.getvalue().split('\n'))
title('Input availability')
for x in TouchFactory.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 pymt_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.')
|