/
print_biom_python_config.py
executable file
·79 lines (63 loc) · 2.48 KB
/
print_biom_python_config.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
#!/usr/bin/env python
"""Print information on the biom-format installation.
For more details, see http://biom-format.org
"""
from sys import platform, version as python_version, executable
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2012, The BIOM-Format Project"
__credits__ = ["Daniel McDonald", "Jose Clemente", "Greg Caporaso",
"Jai Ram Rideout", "Justin Kuczynski", "Andreas Wilke",
"Tobias Paczian", "Rob Knight", "Folker Meyer",
"Sue Huse"]
__url__ = "http://biom-format.org"
__license__ = "GPL"
__version__ = "1.1.0"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.com"
try:
from numpy import __version__ as numpy_lib_version
except ImportError:
numpy_lib_version = "ERROR: Not installed - this is required! (This will also cause the BIOM library to not be importable.)"
try:
from biom import __version__ as biom_lib_version
except ImportError:
biom_lib_version = "ERROR: Can't find the BIOM library code (or numpy) - is it installed and in your $PYTHONPATH?"
try:
from biom.exception import InvalidSparseBackendException
from biom.table import SparseObj
except ImportError:
SparseObj = "ERROR: Can't find the BIOM library code (or numpy) - is it installed and in your $PYTHONPATH?"
except InvalidSparseBackendException as e:
SparseObj = "ERROR: %s" % e
def get_script_version():
return __version__
def print_biom_config():
system_info = [
("Platform", platform),
("Python/GCC version",python_version.replace('\n', ' ')),
("Python executable",executable)]
max_len = max([len(e[0]) for e in system_info])
print "\nSystem information"
print "=================="
for v in system_info:
print "%*s:\t%s" % (max_len,v[0],v[1])
version_info = [
("NumPy version", numpy_lib_version),
("biom-format library version", biom_lib_version),
("biom-format script version", get_script_version()),]
max_len = max([len(e[0]) for e in version_info])
print "\nDependency versions"
print "==================="
for v in version_info:
print "%*s:\t%s" % (max_len,v[0],v[1])
package_info = [
("SparseObj type", SparseObj)
]
max_len = max([len(e[0]) for e in package_info])
print "\nbiom-format package information"
print "==============================="
for v in package_info:
print "%*s:\t%s" % (max_len,v[0],v[1])
print ""
if __name__ == '__main__':
print_biom_config()