Commit | Line | Data |
---|---|---|
81447b5b PP |
1 | # The MIT License (MIT) |
2 | # | |
f6a5e476 | 3 | # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
81447b5b PP |
4 | # |
5 | # Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 | # of this software and associated documentation files (the "Software"), to deal | |
7 | # in the Software without restriction, including without limitation the rights | |
8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | # copies of the Software, and to permit persons to whom the Software is | |
10 | # furnished to do so, subject to the following conditions: | |
11 | # | |
12 | # The above copyright notice and this permission notice shall be included in | |
13 | # all copies or substantial portions of the Software. | |
14 | # | |
15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | # THE SOFTWARE. | |
22 | ||
c946c9de | 23 | # import all public names |
d016011d PP |
24 | from bt2.clock_class import ClockClassOffset |
25 | from bt2.clock_snapshot import _ClockSnapshot | |
26 | from bt2.clock_snapshot import _UnknownClockSnapshot | |
27 | from bt2.component import _SourceComponentClass | |
ede525fd PP |
28 | from bt2.component import _FilterComponentClass |
29 | from bt2.component import _SinkComponentClass | |
f6a5e476 | 30 | from bt2.component import _SourceComponent |
d016011d PP |
31 | from bt2.component import _FilterComponent |
32 | from bt2.component import _SinkComponent | |
33 | from bt2.component import _UserSourceComponent | |
f6a5e476 PP |
34 | from bt2.component import _UserFilterComponent |
35 | from bt2.component import _UserSinkComponent | |
71e8e5c5 | 36 | from bt2.component_descriptor import ComponentDescriptor |
d016011d PP |
37 | from bt2.error import ComponentClassType |
38 | from bt2.error import _ErrorCause | |
39 | from bt2.error import _ComponentErrorCause | |
40 | from bt2.error import _ComponentClassErrorCause | |
41 | from bt2.error import _MessageIteratorErrorCause | |
614743a5 | 42 | from bt2.error import _Error |
d016011d PP |
43 | from bt2.event_class import EventClassLogLevel |
44 | from bt2.field import _IntegerField | |
45 | from bt2.field import _UnsignedIntegerField | |
46 | from bt2.field import _SignedIntegerField | |
47 | from bt2.field import _RealField | |
48 | from bt2.field import _EnumerationField | |
49 | from bt2.field import _UnsignedEnumerationField | |
50 | from bt2.field import _SignedEnumerationField | |
51 | from bt2.field import _StringField | |
52 | from bt2.field import _StructureField | |
53 | from bt2.field import _VariantField | |
54 | from bt2.field import _ArrayField | |
55 | from bt2.field import _StaticArrayField | |
56 | from bt2.field import _DynamicArrayField | |
57 | from bt2.field_class import IntegerDisplayBase | |
58 | from bt2.field_class import _IntegerFieldClass | |
59 | from bt2.field_class import _UnsignedIntegerFieldClass | |
60 | from bt2.field_class import _SignedIntegerFieldClass | |
61 | from bt2.field_class import _RealFieldClass | |
62 | from bt2.field_class import _EnumerationFieldClass | |
63 | from bt2.field_class import _UnsignedEnumerationFieldClass | |
64 | from bt2.field_class import _SignedEnumerationFieldClass | |
65 | from bt2.field_class import _StringFieldClass | |
66 | from bt2.field_class import _StructureFieldClass | |
67 | from bt2.field_class import _VariantFieldClass | |
68 | from bt2.field_class import _VariantFieldClassWithoutSelector | |
69 | from bt2.field_class import _VariantFieldClassWithSelector | |
70 | from bt2.field_class import _VariantFieldClassWithUnsignedSelector | |
71 | from bt2.field_class import _VariantFieldClassWithSignedSelector | |
72 | from bt2.field_class import _ArrayFieldClass | |
73 | from bt2.field_class import _StaticArrayFieldClass | |
74 | from bt2.field_class import _DynamicArrayFieldClass | |
056995e5 | 75 | from bt2.field_path import FieldPathScope |
d016011d PP |
76 | from bt2.field_path import _IndexFieldPathItem |
77 | from bt2.field_path import _CurrentArrayElementFieldPathItem | |
78 | from bt2.graph import Graph | |
79 | from bt2.integer_range_set import SignedIntegerRange | |
80 | from bt2.integer_range_set import UnsignedIntegerRange | |
81 | from bt2.integer_range_set import SignedIntegerRangeSet | |
82 | from bt2.integer_range_set import UnsignedIntegerRangeSet | |
83 | from bt2.interrupter import Interrupter | |
84 | from bt2.logging import LoggingLevel | |
85 | from bt2.logging import get_minimal_logging_level | |
86 | from bt2.logging import get_global_logging_level | |
87 | from bt2.logging import set_global_logging_level | |
88 | from bt2.message import _EventMessage | |
89 | from bt2.message import _PacketBeginningMessage | |
90 | from bt2.message import _PacketEndMessage | |
91 | from bt2.message import _StreamBeginningMessage | |
92 | from bt2.message import _StreamEndMessage | |
93 | from bt2.message import _MessageIteratorInactivityMessage | |
fa4c33e3 SM |
94 | from bt2.message import _DiscardedEventsMessage |
95 | from bt2.message import _DiscardedPacketsMessage | |
fa4c33e3 | 96 | from bt2.message_iterator import _UserMessageIterator |
ea307835 PP |
97 | from bt2.mip import get_greatest_operative_mip_version |
98 | from bt2.mip import get_maximal_mip_version | |
d016011d PP |
99 | from bt2.plugin import find_plugins_in_path |
100 | from bt2.plugin import find_plugins | |
101 | from bt2.plugin import find_plugin | |
102 | from bt2.py_plugin import plugin_component_class | |
103 | from bt2.py_plugin import register_plugin | |
104 | from bt2.query_executor import QueryExecutor | |
94e72386 | 105 | from bt2.trace_collection_message_iterator import AutoSourceComponentSpec |
d016011d PP |
106 | from bt2.trace_collection_message_iterator import ComponentSpec |
107 | from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator | |
108 | from bt2.value import create_value | |
109 | from bt2.value import BoolValue | |
68d9d039 | 110 | from bt2.value import _IntegerValue |
d016011d PP |
111 | from bt2.value import UnsignedIntegerValue |
112 | from bt2.value import SignedIntegerValue | |
113 | from bt2.value import RealValue | |
114 | from bt2.value import StringValue | |
115 | from bt2.value import ArrayValue | |
116 | from bt2.value import MapValue | |
a90c9738 | 117 | from bt2.version import __version__ |
81447b5b PP |
118 | |
119 | ||
c946c9de PP |
120 | def _del_global_name(name): |
121 | if name in globals(): | |
122 | del globals()[name] | |
123 | ||
124 | ||
125 | # remove private module names from the package | |
126 | _del_global_name('_native_bt') | |
127 | _del_global_name('clock_class') | |
128 | _del_global_name('clock_snapshot') | |
129 | _del_global_name('component') | |
130 | _del_global_name('connection') | |
131 | _del_global_name('error') | |
132 | _del_global_name('event') | |
133 | _del_global_name('event_class') | |
134 | _del_global_name('field') | |
135 | _del_global_name('field_class') | |
136 | _del_global_name('field_path') | |
137 | _del_global_name('graph') | |
138 | _del_global_name('integer_range_set') | |
139 | _del_global_name('interrupter') | |
140 | _del_global_name('logging') | |
141 | _del_global_name('message') | |
142 | _del_global_name('message_iterator') | |
143 | _del_global_name('native_bt') | |
144 | _del_global_name('object') | |
145 | _del_global_name('packet') | |
146 | _del_global_name('plugin') | |
147 | _del_global_name('port') | |
148 | _del_global_name('py_plugin') | |
149 | _del_global_name('query_executor') | |
150 | _del_global_name('stream') | |
151 | _del_global_name('stream_class') | |
152 | _del_global_name('trace') | |
153 | _del_global_name('trace_class') | |
154 | _del_global_name('trace_collection_message_iterator') | |
155 | _del_global_name('utils') | |
156 | _del_global_name('value') | |
a90c9738 | 157 | _del_global_name('version') |
c946c9de PP |
158 | |
159 | # remove private `_del_global_name` name from the package | |
160 | del _del_global_name | |
161 | ||
162 | ||
614743a5 | 163 | class _MemoryError(_Error): |
493428a0 | 164 | '''Raised when an operation fails due to memory issues.''' |
81447b5b PP |
165 | |
166 | ||
7dd3e712 SM |
167 | class UnknownObject(Exception): |
168 | ''' | |
169 | Raised when a component class handles a query for an object it doesn't | |
170 | know about. | |
171 | ''' | |
172 | ||
1286dcbb PP |
173 | pass |
174 | ||
175 | ||
35752b44 | 176 | class _OverflowError(_Error, OverflowError): |
81447b5b PP |
177 | pass |
178 | ||
179 | ||
fb25b9e3 | 180 | class TryAgain(Exception): |
81447b5b PP |
181 | pass |
182 | ||
183 | ||
fb25b9e3 PP |
184 | class Stop(StopIteration): |
185 | pass | |
186 | ||
187 | ||
64e96b5d | 188 | class _IncompleteUserClass(Exception): |
f6a5e476 PP |
189 | pass |
190 | ||
191 | ||
5c8b3186 | 192 | def _init_and_register_exit(): |
c946c9de | 193 | from bt2 import native_bt |
5c8b3186 PP |
194 | import atexit |
195 | ||
65e28173 PP |
196 | atexit.register(native_bt.bt2_exit_handler) |
197 | native_bt.bt2_init_from_bt2() | |
5c8b3186 PP |
198 | |
199 | ||
200 | _init_and_register_exit() | |
201 | ||
c946c9de PP |
202 | # remove private `_init_and_register_exit` name from the package |
203 | del _init_and_register_exit |