Belle II Software
development
information.py
1
8
from
datetime
import
datetime
9
from
subprocess
import
check_output
10
11
12
class
EnvironmentInformation
:
13
14
"""
15
Helper class for accessing the information about the environment.
16
"""
17
18
def
__init__
(self):
19
"""
20
Get the variables from the environment variables.
21
"""
22
23
self.
externals_version
=
""
24
25
self.
externals_option
=
""
26
27
self.
option
=
""
28
29
self.
architecture
=
""
30
31
self.
release
=
""
32
33
self.
release_folder
=
""
34
35
self.
_cached_revision
=
""
36
37
@property
38
def
revision_number
(self):
39
"""
40
Get the cached revision number from SVN or get it from SVN directly.
41
"""
42
if
not
self.
_cached_revision
:
43
self.
_cached_revision
= self.
get_current_revision_number
()
44
45
return
self.
_cached_revision
46
47
def
__str__
(self):
48
"""
49
A nice representation.
50
"""
51
result =
""
52
result +=
"externals version: "
+ self.
externals_version
+
"\n"
53
result +=
"externals option: "
+ self.
externals_option
+
"\n"
54
result +=
"option: "
+ self.
option
+
"\n"
55
result +=
"architecture: "
+ self.
architecture
+
"\n"
56
result +=
"release: "
+ self.
release
+
"\n"
57
result +=
"release folder: "
+ self.
release_folder
+
"\n"
58
result +=
"revision number: "
+ self.
revision_number
+
"\n"
59
result +=
"date: "
+ datetime.now().strftime(
"%Y-%m-%d"
) +
"\n"
60
return
result
61
62
def
__repr__
(self):
63
"""
64
Also for ipython.
65
"""
66
return
self.
__str__
()
67
68
def
get_current_revision_number
(self):
69
"""
70
Try to download the current revision number from SVN.
71
"""
72
try
:
73
return
check_output([
"git"
,
"log"
,
"-1"
,
"--format='%H'"
], cwd=self.
release_folder
).decode()
74
except
BaseException:
75
return
""
hep_ipython_tools.information.EnvironmentInformation
Definition
information.py:12
hep_ipython_tools.information.EnvironmentInformation.get_current_revision_number
get_current_revision_number(self)
Definition
information.py:68
hep_ipython_tools.information.EnvironmentInformation.__str__
__str__(self)
Definition
information.py:47
hep_ipython_tools.information.EnvironmentInformation.release_folder
str release_folder
Release folder.
Definition
information.py:33
hep_ipython_tools.information.EnvironmentInformation.__repr__
__repr__(self)
Definition
information.py:62
hep_ipython_tools.information.EnvironmentInformation.architecture
str architecture
OS.
Definition
information.py:29
hep_ipython_tools.information.EnvironmentInformation.revision_number
revision_number(self)
Definition
information.py:38
hep_ipython_tools.information.EnvironmentInformation.externals_version
str externals_version
Externals version.
Definition
information.py:23
hep_ipython_tools.information.EnvironmentInformation.__init__
__init__(self)
Definition
information.py:18
hep_ipython_tools.information.EnvironmentInformation.release
str release
Release version.
Definition
information.py:31
hep_ipython_tools.information.EnvironmentInformation._cached_revision
str _cached_revision
Revision number (cached, the real getter is the property)
Definition
information.py:35
hep_ipython_tools.information.EnvironmentInformation.externals_option
str externals_option
Compile options of externals.
Definition
information.py:25
hep_ipython_tools.information.EnvironmentInformation.option
str option
Compile options.
Definition
information.py:27
framework
scripts
hep_ipython_tools
information.py
Generated on Mon Sep 1 2025 02:51:51 for Belle II Software by
1.13.2