Belle II Software  release-08-01-10
print_info.py
1 #!/usr/bin/env python3
2 
3 
10 
11 from basf2.core import basf2label, basf2copyright, basf2license, list_module_search_paths, LogPythonInterface
12 from basf2.version import get_version, get_release
13 from basf2 import conditions
14 
15 import os
16 import sys
17 
18 # The Belle II logo graphics
19 logo = """\
20 
21  eeeeeeee
22  eeeeeeeeeeeeeeeeeeee
23  eeeeeeee eeeeeeeeeeeeeeee
24  eeeeee eeee eeeeee
25  eeee eeee eeee
26  eeee eeee eeee
27  eeeee eeee eeee
28  eeee eeeeeeeeeeeeeeeee
29  eeeeeeeeeeeee
30 
31  eeeeeeeeeeeeee
32  eeeeeeeeeeeeeeeeeee
33  eeee eeee eeeeee
34  eeee eeee eeeeee
35  eeee eeee eeeee
36  eeee eeee eeeee
37  eeee eeee eeeeeee
38  eeeeee eeeeeeeeeeeeeeeeeeeee
39  eeeeeeeeeeeeeeeeeeeeeeeeee
40  eeeeeeeeeeeeeeeee
41 
42  BBBBBBB ll ll 2222222
43  BB BB eeee ll ll eeee 22 22
44  BB BB ee ee ll ll ee ee 22 22
45  BBBBBBB eeeeeeee ll ll eeeeeeee 22 22
46  BB BB ee ll ll ee 22 22
47  BB BB ee ee ll ll ee ee 22 22
48  BBBBBBBB eeeee ll ll eeeee 2222222
49 
50 """
51 
52 if LogPythonInterface.terminal_supports_colors():
53  CSI = "\x1B["
54  color = CSI + '93;44m'
55  reset = CSI + '0m'
56 else:
57  color = ""
58  reset = ""
59 
60 for line in logo.splitlines():
61  print(color + line.ljust(48) + reset)
62 
63 print('')
64 print(basf2label.center(48))
65 print(basf2copyright.center(48))
66 print(basf2license.center(48))
67 print(('Release ' + get_release()).center(48))
68 print(('Version ' + get_version()).center(48))
69 print('')
70 print('-' * 48)
71 for var in ["RELEASE", "RELEASE_DIR", "LOCAL_DIR", "SUBDIR", "EXTERNALS_VERSION", "ARCH"]:
72  name = "BELLE2_" + var
73  print((name + ":").ljust(25), os.environ.get(name, ''))
74 
75 print('Default global tags:'.ljust(25), conditions.default_globaltags)
76 print('Kernel version:'.ljust(25), os.uname()[2])
77 python_version = sys.version_info[:3]
78 print('Python version:'.ljust(25), '.'.join(str(ver) for ver in python_version))
79 try:
80  from ROOT import gROOT
81  gROOT.SetBatch()
82  rootver = gROOT.GetVersion()
83 except ImportError:
84  rootver = 'PyROOT broken, cannot get version!'
85 print('ROOT version:'.ljust(25), rootver)
86 print('')
87 print('basf2 module directories:'.ljust(25))
88 for dirname in list_module_search_paths():
89  print(' ', dirname)
90 
91 print('-' * 48)