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
|
#! /usr/bin/env python
import os, subprocess, sys, traceback
def foldlines(s):
return s.replace("\n", " ").replace("\r", "")
def print_platform():
print
try:
import platform
out = platform.platform()
print
print "platform:", out.replace("\n", " ")
except EnvironmentError:
sys.stderr.write("Got exception using 'platform'. Exception follows\n")
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
def print_python_ver():
print
print "python:", foldlines(sys.version)
print 'maxunicode: ' + str(sys.maxunicode)
def print_stdout(cmdlist, label=None):
print
try:
res = subprocess.Popen(cmdlist, stdin=open(os.devnull),
stdout=subprocess.PIPE).communicate()[0]
if label is None:
label = cmdlist[0]
print label + ': ' + foldlines(res)
except EnvironmentError:
sys.stderr.write("\nGot exception invoking '%s'. Exception follows.\n" % (cmdlist[0],))
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
def print_as_ver():
print
if os.path.exists('a.out'):
print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'."
return
try:
res = subprocess.Popen(['as', '-version'], stdin=open(os.devnull),
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
print 'as: ' + foldlines(res[0]+' '+res[1])
if os.path.exists('a.out'):
os.remove('a.out')
except EnvironmentError:
sys.stderr.write("\nGot exception invoking '%s'. Exception follows.\n" % ('as',))
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
def print_setuptools_ver():
print
try:
import pkg_resources
out = str(pkg_resources.require("setuptools"))
print "setuptools:", foldlines(out)
except (ImportError, EnvironmentError):
sys.stderr.write("\nGot exception using 'pkg_resources' to get the version of setuptools. Exception follows\n")
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
def print_py_pkg_ver(pkgname, modulename=None):
if modulename is None:
modulename = pkgname
print
try:
import pkg_resources
out = str(pkg_resources.require(pkgname))
print pkgname + ': ' + foldlines(out)
except (ImportError, EnvironmentError):
sys.stderr.write("\nGot exception using 'pkg_resources' to get the version of %s. Exception follows.\n" % (pkgname,))
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
except pkg_resources.DistributionNotFound:
sys.stderr.write("\npkg_resources reported no %s package installed. Exception follows.\n" % (pkgname,))
traceback.print_exc(file=sys.stderr)
sys.stderr.flush()
pass
try:
__import__(modulename)
except ImportError:
pass
else:
modobj = sys.modules.get(modulename)
print pkgname + ' module: ' + str(modobj)
try:
print pkgname + ' __version__: ' + str(modobj.__version__)
except AttributeError:
pass
print_platform()
print_python_ver()
print_stdout(['buildbot', '--version'])
print_stdout(['cl'])
print_stdout(['g++', '--version'])
print_stdout(['cryptest', 'V'])
print_stdout(['darcs', '--version'])
print_stdout(['darcs', '--exact-version'], label='darcs-exact-version')
print_stdout(['7za'])
print_stdout(['flappclient', '--version'])
print_stdout(['valgrind', '--version'])
print_as_ver()
print_setuptools_ver()
print_py_pkg_ver('coverage')
print_py_pkg_ver('trialcoverage')
print_py_pkg_ver('setuptools_trial')
print_py_pkg_ver('setuptools_darcs')
print_py_pkg_ver('darcsver')
print_py_pkg_ver('Twisted', 'twisted')
print_py_pkg_ver('TwistedCore', 'twisted.python')
|