forked from ROBelgium/MSNoise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbugreport.py
104 lines (85 loc) · 3.07 KB
/
bugreport.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
# -*- coding: utf-8 -*-
#
def ispresent(module):
try:
mod = __import__(module)
if hasattr(mod, '__version__'):
print "[X] %s: %s"%(module,mod.__version__)
else:
print "[X] %s: present (no version)"%module
except:
print "[ ] %s: not found"%module
import os, platform
import sys
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Helps determining what didn\'t work')
parser.add_argument('-s', '--sys', action="store_true",
help='Outputs System info',
default=False)
parser.add_argument('-m', '--modules', action="store_true",
help='Outputs Python Modules Presence/Version',
default=False)
parser.add_argument('-e', '--env', action="store_true",
help='Outputs System Environment Variables',
default=False)
parser.add_argument('-a', '--all', action="store_true",
help='Outputs all of the above',
default=False)
args = parser.parse_args()
print "************* Computer Report *************"
if args.sys or args.all:
print
print "----------------+SYSTEM+-------------------"
print "\n".join(platform.uname())
if platform.system() == "Linux":
print " - ".join(platform.linux_distribution())
print
print "----------------+PYTHON+-------------------"
print "Python:",sys.version
print
if args.modules or args.all:
print "---------------+MODULES+-------------------"
print
print "Required:"
ispresent('numpy')
ispresent('scipy')
ispresent('pandas')
ispresent('matplotlib')
ispresent('statsmodels')
ispresent('sqlalchemy')
ispresent('traitsui')
ispresent('traits')
ispresent('enable')
ispresent('scikits.samplerate')
ispresent('obspy')
ispresent('sphinx')
ispresent('jinja2')
print
print "Backends: (at least one is required)"
ispresent('wx')
ispresent('PyQt4')
ispresent('PySide')
print
print "Not required, just checking:"
ispresent('setuptools')
ispresent('reportlab')
ispresent('configobj')
ispresent('pkg_resources')
ispresent('paramiko')
ispresent('ctypes')
ispresent('pyparsing')
ispresent('distutils')
ispresent('IPython')
ispresent('vtk')
print
if args.env or args.all:
print "------------------+ENV+--------------------"
for key in os.environ.keys():
print key
for value in os.environ[key].split(';'):
if os.path.isdir(value) or os.path.isfile(value) :
dir = "[X]"
else:
dir = "[ ]"
print " ", dir, value