Commit | Line | Data |
---|---|---|
0235b0db | 1 | # SPDX-License-Identifier: MIT |
81447b5b | 2 | # |
811644b8 | 3 | # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
81447b5b | 4 | |
79935628 SM |
5 | import sys |
6 | ||
3fb99a22 | 7 | # import all public names |
5290f876 | 8 | from bt2.clock_class import ClockClassOffset |
eddea575 | 9 | from bt2.clock_snapshot import _ClockSnapshotConst |
5290f876 | 10 | from bt2.clock_snapshot import _UnknownClockSnapshot |
615238be FD |
11 | from bt2.component import _SourceComponentClassConst |
12 | from bt2.component import _FilterComponentClassConst | |
13 | from bt2.component import _SinkComponentClassConst | |
14 | from bt2.component import _SourceComponentConst | |
15 | from bt2.component import _FilterComponentConst | |
16 | from bt2.component import _SinkComponentConst | |
5290f876 | 17 | from bt2.component import _UserSourceComponent |
811644b8 PP |
18 | from bt2.component import _UserFilterComponent |
19 | from bt2.component import _UserSinkComponent | |
f865c2aa | 20 | from bt2.component_descriptor import ComponentDescriptor |
5290f876 PP |
21 | from bt2.error import ComponentClassType |
22 | from bt2.error import _ErrorCause | |
23 | from bt2.error import _ComponentErrorCause | |
24 | from bt2.error import _ComponentClassErrorCause | |
25 | from bt2.error import _MessageIteratorErrorCause | |
694c792b | 26 | from bt2.error import _Error |
5290f876 | 27 | from bt2.event_class import EventClassLogLevel |
aae30e61 | 28 | from bt2.field import _BoolField |
ead8c3d4 | 29 | from bt2.field import _BitArrayField |
5290f876 PP |
30 | from bt2.field import _IntegerField |
31 | from bt2.field import _UnsignedIntegerField | |
32 | from bt2.field import _SignedIntegerField | |
33 | from bt2.field import _RealField | |
fe4df857 FD |
34 | from bt2.field import _SinglePrecisionRealField |
35 | from bt2.field import _DoublePrecisionRealField | |
5290f876 PP |
36 | from bt2.field import _EnumerationField |
37 | from bt2.field import _UnsignedEnumerationField | |
38 | from bt2.field import _SignedEnumerationField | |
39 | from bt2.field import _StringField | |
40 | from bt2.field import _StructureField | |
cec0261d | 41 | from bt2.field import _OptionField |
5290f876 PP |
42 | from bt2.field import _VariantField |
43 | from bt2.field import _ArrayField | |
44 | from bt2.field import _StaticArrayField | |
45 | from bt2.field import _DynamicArrayField | |
f0a42b33 FD |
46 | from bt2.field import _BoolFieldConst |
47 | from bt2.field import _BitArrayFieldConst | |
48 | from bt2.field import _IntegerFieldConst | |
49 | from bt2.field import _UnsignedIntegerFieldConst | |
50 | from bt2.field import _SignedIntegerFieldConst | |
51 | from bt2.field import _RealFieldConst | |
fe4df857 FD |
52 | from bt2.field import _SinglePrecisionRealFieldConst |
53 | from bt2.field import _DoublePrecisionRealFieldConst | |
f0a42b33 FD |
54 | from bt2.field import _EnumerationFieldConst |
55 | from bt2.field import _UnsignedEnumerationFieldConst | |
56 | from bt2.field import _SignedEnumerationFieldConst | |
57 | from bt2.field import _StringFieldConst | |
58 | from bt2.field import _StructureFieldConst | |
59 | from bt2.field import _OptionFieldConst | |
60 | from bt2.field import _VariantFieldConst | |
61 | from bt2.field import _ArrayFieldConst | |
62 | from bt2.field import _StaticArrayFieldConst | |
63 | from bt2.field import _DynamicArrayFieldConst | |
5290f876 | 64 | from bt2.field_class import IntegerDisplayBase |
aae30e61 | 65 | from bt2.field_class import _BoolFieldClass |
ead8c3d4 | 66 | from bt2.field_class import _BitArrayFieldClass |
5290f876 PP |
67 | from bt2.field_class import _IntegerFieldClass |
68 | from bt2.field_class import _UnsignedIntegerFieldClass | |
69 | from bt2.field_class import _SignedIntegerFieldClass | |
70 | from bt2.field_class import _RealFieldClass | |
71 | from bt2.field_class import _EnumerationFieldClass | |
72 | from bt2.field_class import _UnsignedEnumerationFieldClass | |
73 | from bt2.field_class import _SignedEnumerationFieldClass | |
74 | from bt2.field_class import _StringFieldClass | |
75 | from bt2.field_class import _StructureFieldClass | |
cec0261d | 76 | from bt2.field_class import _OptionFieldClass |
0aa006b7 PP |
77 | from bt2.field_class import _OptionWithSelectorFieldClass |
78 | from bt2.field_class import _OptionWithBoolSelectorFieldClass | |
79 | from bt2.field_class import _OptionWithIntegerSelectorFieldClass | |
80 | from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClass | |
81 | from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClass | |
5290f876 PP |
82 | from bt2.field_class import _VariantFieldClass |
83 | from bt2.field_class import _VariantFieldClassWithoutSelector | |
fabfe034 PP |
84 | from bt2.field_class import _VariantFieldClassWithIntegerSelector |
85 | from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelector | |
86 | from bt2.field_class import _VariantFieldClassWithSignedIntegerSelector | |
5290f876 PP |
87 | from bt2.field_class import _ArrayFieldClass |
88 | from bt2.field_class import _StaticArrayFieldClass | |
89 | from bt2.field_class import _DynamicArrayFieldClass | |
81b8fa44 | 90 | from bt2.field_class import _DynamicArrayWithLengthFieldFieldClass |
f0a42b33 FD |
91 | from bt2.field_class import _BoolFieldClassConst |
92 | from bt2.field_class import _BitArrayFieldClassConst | |
93 | from bt2.field_class import _IntegerFieldClassConst | |
94 | from bt2.field_class import _UnsignedIntegerFieldClassConst | |
95 | from bt2.field_class import _SignedIntegerFieldClassConst | |
96 | from bt2.field_class import _RealFieldClassConst | |
97 | from bt2.field_class import _EnumerationFieldClassConst | |
98 | from bt2.field_class import _UnsignedEnumerationFieldClassConst | |
99 | from bt2.field_class import _SignedEnumerationFieldClassConst | |
100 | from bt2.field_class import _StringFieldClassConst | |
101 | from bt2.field_class import _StructureFieldClassConst | |
102 | from bt2.field_class import _OptionFieldClassConst | |
0aa006b7 PP |
103 | from bt2.field_class import _OptionWithSelectorFieldClassConst |
104 | from bt2.field_class import _OptionWithBoolSelectorFieldClassConst | |
105 | from bt2.field_class import _OptionWithIntegerSelectorFieldClassConst | |
106 | from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClassConst | |
107 | from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClassConst | |
f0a42b33 FD |
108 | from bt2.field_class import _VariantFieldClassConst |
109 | from bt2.field_class import _VariantFieldClassWithoutSelectorConst | |
fabfe034 PP |
110 | from bt2.field_class import _VariantFieldClassWithIntegerSelectorConst |
111 | from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelectorConst | |
112 | from bt2.field_class import _VariantFieldClassWithSignedIntegerSelectorConst | |
f0a42b33 FD |
113 | from bt2.field_class import _ArrayFieldClassConst |
114 | from bt2.field_class import _StaticArrayFieldClassConst | |
115 | from bt2.field_class import _DynamicArrayFieldClassConst | |
81b8fa44 | 116 | from bt2.field_class import _DynamicArrayWithLengthFieldFieldClassConst |
e7ceb9df | 117 | from bt2.field_path import FieldPathScope |
5290f876 PP |
118 | from bt2.field_path import _IndexFieldPathItem |
119 | from bt2.field_path import _CurrentArrayElementFieldPathItem | |
cec0261d | 120 | from bt2.field_path import _CurrentOptionContentFieldPathItem |
5290f876 PP |
121 | from bt2.graph import Graph |
122 | from bt2.integer_range_set import SignedIntegerRange | |
123 | from bt2.integer_range_set import UnsignedIntegerRange | |
124 | from bt2.integer_range_set import SignedIntegerRangeSet | |
125 | from bt2.integer_range_set import UnsignedIntegerRangeSet | |
fc866000 FD |
126 | from bt2.integer_range_set import _SignedIntegerRangeConst |
127 | from bt2.integer_range_set import _UnsignedIntegerRangeConst | |
128 | from bt2.integer_range_set import _SignedIntegerRangeSetConst | |
129 | from bt2.integer_range_set import _UnsignedIntegerRangeSetConst | |
5290f876 PP |
130 | from bt2.interrupter import Interrupter |
131 | from bt2.logging import LoggingLevel | |
132 | from bt2.logging import get_minimal_logging_level | |
133 | from bt2.logging import get_global_logging_level | |
134 | from bt2.logging import set_global_logging_level | |
135 | from bt2.message import _EventMessage | |
136 | from bt2.message import _PacketBeginningMessage | |
137 | from bt2.message import _PacketEndMessage | |
138 | from bt2.message import _StreamBeginningMessage | |
139 | from bt2.message import _StreamEndMessage | |
140 | from bt2.message import _MessageIteratorInactivityMessage | |
5602ef81 SM |
141 | from bt2.message import _DiscardedEventsMessage |
142 | from bt2.message import _DiscardedPacketsMessage | |
f0a42b33 FD |
143 | from bt2.message import _EventMessageConst |
144 | from bt2.message import _PacketBeginningMessageConst | |
145 | from bt2.message import _PacketEndMessageConst | |
146 | from bt2.message import _StreamBeginningMessageConst | |
147 | from bt2.message import _StreamEndMessageConst | |
148 | from bt2.message import _MessageIteratorInactivityMessageConst | |
149 | from bt2.message import _DiscardedEventsMessageConst | |
150 | from bt2.message import _DiscardedPacketsMessageConst | |
5602ef81 | 151 | from bt2.message_iterator import _UserMessageIterator |
f1f74173 PP |
152 | from bt2.mip import get_greatest_operative_mip_version |
153 | from bt2.mip import get_maximal_mip_version | |
5290f876 PP |
154 | from bt2.plugin import find_plugins_in_path |
155 | from bt2.plugin import find_plugins | |
156 | from bt2.plugin import find_plugin | |
157 | from bt2.py_plugin import plugin_component_class | |
158 | from bt2.py_plugin import register_plugin | |
159 | from bt2.query_executor import QueryExecutor | |
f3c9a159 | 160 | from bt2.trace_collection_message_iterator import AutoSourceComponentSpec |
5290f876 PP |
161 | from bt2.trace_collection_message_iterator import ComponentSpec |
162 | from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator | |
163 | from bt2.value import create_value | |
164 | from bt2.value import BoolValue | |
fdd3a2da | 165 | from bt2.value import _IntegerValue |
5290f876 PP |
166 | from bt2.value import UnsignedIntegerValue |
167 | from bt2.value import SignedIntegerValue | |
168 | from bt2.value import RealValue | |
169 | from bt2.value import StringValue | |
170 | from bt2.value import ArrayValue | |
171 | from bt2.value import MapValue | |
e42e1587 FD |
172 | from bt2.value import _BoolValueConst |
173 | from bt2.value import _IntegerValueConst | |
174 | from bt2.value import _UnsignedIntegerValueConst | |
175 | from bt2.value import _SignedIntegerValueConst | |
176 | from bt2.value import _RealValueConst | |
177 | from bt2.value import _StringValueConst | |
178 | from bt2.value import _ArrayValueConst | |
179 | from bt2.value import _MapValueConst | |
07041daf | 180 | from bt2.version import __version__ |
81447b5b | 181 | |
79935628 SM |
182 | if (sys.version_info.major, sys.version_info.minor) != (3, 4): |
183 | ||
184 | def _del_global_name(name): | |
185 | if name in globals(): | |
186 | del globals()[name] | |
81447b5b | 187 | |
79935628 SM |
188 | # remove private module names from the package |
189 | _del_global_name('_native_bt') | |
190 | _del_global_name('clock_class') | |
191 | _del_global_name('clock_snapshot') | |
192 | _del_global_name('component') | |
193 | _del_global_name('connection') | |
194 | _del_global_name('error') | |
195 | _del_global_name('event') | |
196 | _del_global_name('event_class') | |
197 | _del_global_name('field') | |
198 | _del_global_name('field_class') | |
199 | _del_global_name('field_path') | |
200 | _del_global_name('graph') | |
201 | _del_global_name('integer_range_set') | |
202 | _del_global_name('interrupter') | |
203 | _del_global_name('logging') | |
204 | _del_global_name('message') | |
205 | _del_global_name('message_iterator') | |
206 | _del_global_name('native_bt') | |
207 | _del_global_name('object') | |
208 | _del_global_name('packet') | |
209 | _del_global_name('plugin') | |
210 | _del_global_name('port') | |
211 | _del_global_name('py_plugin') | |
212 | _del_global_name('query_executor') | |
213 | _del_global_name('stream') | |
214 | _del_global_name('stream_class') | |
215 | _del_global_name('trace') | |
216 | _del_global_name('trace_class') | |
217 | _del_global_name('trace_collection_message_iterator') | |
218 | _del_global_name('utils') | |
219 | _del_global_name('value') | |
220 | _del_global_name('version') | |
3fb99a22 | 221 | |
79935628 SM |
222 | # remove private `_del_global_name` name from the package |
223 | del _del_global_name | |
3fb99a22 | 224 | |
3fb99a22 | 225 | |
79935628 SM |
226 | # remove sys module name from the package |
227 | del sys | |
3fb99a22 PP |
228 | |
229 | ||
694c792b | 230 | class _MemoryError(_Error): |
4acc866e | 231 | '''Raised when an operation fails due to memory issues.''' |
81447b5b PP |
232 | |
233 | ||
76b6c2f7 SM |
234 | class UnknownObject(Exception): |
235 | ''' | |
236 | Raised when a component class handles a query for an object it doesn't | |
237 | know about. | |
238 | ''' | |
239 | ||
c7eee084 PP |
240 | pass |
241 | ||
242 | ||
0ddaae90 | 243 | class _OverflowError(_Error, OverflowError): |
81447b5b PP |
244 | pass |
245 | ||
246 | ||
d24d5663 | 247 | class TryAgain(Exception): |
81447b5b PP |
248 | pass |
249 | ||
250 | ||
d24d5663 PP |
251 | class Stop(StopIteration): |
252 | pass | |
253 | ||
254 | ||
cb06aa27 | 255 | class _IncompleteUserClass(Exception): |
811644b8 PP |
256 | pass |
257 | ||
258 | ||
0b03f63e | 259 | def _init_and_register_exit(): |
3fb99a22 | 260 | from bt2 import native_bt |
0b03f63e PP |
261 | import atexit |
262 | ||
612a9870 PP |
263 | atexit.register(native_bt.bt2_exit_handler) |
264 | native_bt.bt2_init_from_bt2() | |
0b03f63e PP |
265 | |
266 | ||
267 | _init_and_register_exit() | |
268 | ||
3fb99a22 PP |
269 | # remove private `_init_and_register_exit` name from the package |
270 | del _init_and_register_exit |