1 # The MIT License (MIT)
3 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
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:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
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
26 # With Python ≥ 3.8 on Windows, the DLL lookup mechanism to load native
27 # modules doesn't search the `PATH` environment variable like everything
28 # else on this platform.
30 # See <https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew>.
32 # Restore this behaviour by doing it manually.
33 if os
.name
== "nt" and sys
.version_info
>= (3, 8):
34 for path
in os
.getenv("PATH", "").split(os
.pathsep
):
35 if os
.path
.exists(path
) and path
!= ".":
36 os
.add_dll_directory(path
)
40 # import all public names
41 from bt2
.clock_class
import ClockClassOffset
42 from bt2
.clock_snapshot
import _ClockSnapshotConst
43 from bt2
.clock_snapshot
import _UnknownClockSnapshot
44 from bt2
.component
import _SourceComponentClassConst
45 from bt2
.component
import _FilterComponentClassConst
46 from bt2
.component
import _SinkComponentClassConst
47 from bt2
.component
import _SourceComponentConst
48 from bt2
.component
import _FilterComponentConst
49 from bt2
.component
import _SinkComponentConst
50 from bt2
.component
import _UserSourceComponent
51 from bt2
.component
import _UserFilterComponent
52 from bt2
.component
import _UserSinkComponent
53 from bt2
.component_descriptor
import ComponentDescriptor
54 from bt2
.error
import ComponentClassType
55 from bt2
.error
import _ErrorCause
56 from bt2
.error
import _ComponentErrorCause
57 from bt2
.error
import _ComponentClassErrorCause
58 from bt2
.error
import _MessageIteratorErrorCause
59 from bt2
.error
import _Error
60 from bt2
.event_class
import EventClassLogLevel
61 from bt2
.field
import _BoolField
62 from bt2
.field
import _BitArrayField
63 from bt2
.field
import _IntegerField
64 from bt2
.field
import _UnsignedIntegerField
65 from bt2
.field
import _SignedIntegerField
66 from bt2
.field
import _RealField
67 from bt2
.field
import _SinglePrecisionRealField
68 from bt2
.field
import _DoublePrecisionRealField
69 from bt2
.field
import _EnumerationField
70 from bt2
.field
import _UnsignedEnumerationField
71 from bt2
.field
import _SignedEnumerationField
72 from bt2
.field
import _StringField
73 from bt2
.field
import _StructureField
74 from bt2
.field
import _OptionField
75 from bt2
.field
import _VariantField
76 from bt2
.field
import _ArrayField
77 from bt2
.field
import _StaticArrayField
78 from bt2
.field
import _DynamicArrayField
79 from bt2
.field
import _BoolFieldConst
80 from bt2
.field
import _BitArrayFieldConst
81 from bt2
.field
import _IntegerFieldConst
82 from bt2
.field
import _UnsignedIntegerFieldConst
83 from bt2
.field
import _SignedIntegerFieldConst
84 from bt2
.field
import _RealFieldConst
85 from bt2
.field
import _SinglePrecisionRealFieldConst
86 from bt2
.field
import _DoublePrecisionRealFieldConst
87 from bt2
.field
import _EnumerationFieldConst
88 from bt2
.field
import _UnsignedEnumerationFieldConst
89 from bt2
.field
import _SignedEnumerationFieldConst
90 from bt2
.field
import _StringFieldConst
91 from bt2
.field
import _StructureFieldConst
92 from bt2
.field
import _OptionFieldConst
93 from bt2
.field
import _VariantFieldConst
94 from bt2
.field
import _ArrayFieldConst
95 from bt2
.field
import _StaticArrayFieldConst
96 from bt2
.field
import _DynamicArrayFieldConst
97 from bt2
.field_class
import IntegerDisplayBase
98 from bt2
.field_class
import _BoolFieldClass
99 from bt2
.field_class
import _BitArrayFieldClass
100 from bt2
.field_class
import _IntegerFieldClass
101 from bt2
.field_class
import _UnsignedIntegerFieldClass
102 from bt2
.field_class
import _SignedIntegerFieldClass
103 from bt2
.field_class
import _RealFieldClass
104 from bt2
.field_class
import _EnumerationFieldClass
105 from bt2
.field_class
import _UnsignedEnumerationFieldClass
106 from bt2
.field_class
import _SignedEnumerationFieldClass
107 from bt2
.field_class
import _StringFieldClass
108 from bt2
.field_class
import _StructureFieldClass
109 from bt2
.field_class
import _OptionFieldClass
110 from bt2
.field_class
import _OptionWithSelectorFieldClass
111 from bt2
.field_class
import _OptionWithBoolSelectorFieldClass
112 from bt2
.field_class
import _OptionWithIntegerSelectorFieldClass
113 from bt2
.field_class
import _OptionWithUnsignedIntegerSelectorFieldClass
114 from bt2
.field_class
import _OptionWithSignedIntegerSelectorFieldClass
115 from bt2
.field_class
import _VariantFieldClass
116 from bt2
.field_class
import _VariantFieldClassWithoutSelector
117 from bt2
.field_class
import _VariantFieldClassWithIntegerSelector
118 from bt2
.field_class
import _VariantFieldClassWithUnsignedIntegerSelector
119 from bt2
.field_class
import _VariantFieldClassWithSignedIntegerSelector
120 from bt2
.field_class
import _ArrayFieldClass
121 from bt2
.field_class
import _StaticArrayFieldClass
122 from bt2
.field_class
import _DynamicArrayFieldClass
123 from bt2
.field_class
import _DynamicArrayWithLengthFieldFieldClass
124 from bt2
.field_class
import _BoolFieldClassConst
125 from bt2
.field_class
import _BitArrayFieldClassConst
126 from bt2
.field_class
import _IntegerFieldClassConst
127 from bt2
.field_class
import _UnsignedIntegerFieldClassConst
128 from bt2
.field_class
import _SignedIntegerFieldClassConst
129 from bt2
.field_class
import _RealFieldClassConst
130 from bt2
.field_class
import _EnumerationFieldClassConst
131 from bt2
.field_class
import _UnsignedEnumerationFieldClassConst
132 from bt2
.field_class
import _SignedEnumerationFieldClassConst
133 from bt2
.field_class
import _StringFieldClassConst
134 from bt2
.field_class
import _StructureFieldClassConst
135 from bt2
.field_class
import _OptionFieldClassConst
136 from bt2
.field_class
import _OptionWithSelectorFieldClassConst
137 from bt2
.field_class
import _OptionWithBoolSelectorFieldClassConst
138 from bt2
.field_class
import _OptionWithIntegerSelectorFieldClassConst
139 from bt2
.field_class
import _OptionWithUnsignedIntegerSelectorFieldClassConst
140 from bt2
.field_class
import _OptionWithSignedIntegerSelectorFieldClassConst
141 from bt2
.field_class
import _VariantFieldClassConst
142 from bt2
.field_class
import _VariantFieldClassWithoutSelectorConst
143 from bt2
.field_class
import _VariantFieldClassWithIntegerSelectorConst
144 from bt2
.field_class
import _VariantFieldClassWithUnsignedIntegerSelectorConst
145 from bt2
.field_class
import _VariantFieldClassWithSignedIntegerSelectorConst
146 from bt2
.field_class
import _ArrayFieldClassConst
147 from bt2
.field_class
import _StaticArrayFieldClassConst
148 from bt2
.field_class
import _DynamicArrayFieldClassConst
149 from bt2
.field_class
import _DynamicArrayWithLengthFieldFieldClassConst
150 from bt2
.field_path
import FieldPathScope
151 from bt2
.field_path
import _IndexFieldPathItem
152 from bt2
.field_path
import _CurrentArrayElementFieldPathItem
153 from bt2
.field_path
import _CurrentOptionContentFieldPathItem
154 from bt2
.graph
import Graph
155 from bt2
.integer_range_set
import SignedIntegerRange
156 from bt2
.integer_range_set
import UnsignedIntegerRange
157 from bt2
.integer_range_set
import SignedIntegerRangeSet
158 from bt2
.integer_range_set
import UnsignedIntegerRangeSet
159 from bt2
.integer_range_set
import _SignedIntegerRangeConst
160 from bt2
.integer_range_set
import _UnsignedIntegerRangeConst
161 from bt2
.integer_range_set
import _SignedIntegerRangeSetConst
162 from bt2
.integer_range_set
import _UnsignedIntegerRangeSetConst
163 from bt2
.interrupter
import Interrupter
164 from bt2
.logging
import LoggingLevel
165 from bt2
.logging
import get_minimal_logging_level
166 from bt2
.logging
import get_global_logging_level
167 from bt2
.logging
import set_global_logging_level
168 from bt2
.message
import _EventMessage
169 from bt2
.message
import _PacketBeginningMessage
170 from bt2
.message
import _PacketEndMessage
171 from bt2
.message
import _StreamBeginningMessage
172 from bt2
.message
import _StreamEndMessage
173 from bt2
.message
import _MessageIteratorInactivityMessage
174 from bt2
.message
import _DiscardedEventsMessage
175 from bt2
.message
import _DiscardedPacketsMessage
176 from bt2
.message
import _EventMessageConst
177 from bt2
.message
import _PacketBeginningMessageConst
178 from bt2
.message
import _PacketEndMessageConst
179 from bt2
.message
import _StreamBeginningMessageConst
180 from bt2
.message
import _StreamEndMessageConst
181 from bt2
.message
import _MessageIteratorInactivityMessageConst
182 from bt2
.message
import _DiscardedEventsMessageConst
183 from bt2
.message
import _DiscardedPacketsMessageConst
184 from bt2
.message_iterator
import _UserMessageIterator
185 from bt2
.mip
import get_greatest_operative_mip_version
186 from bt2
.mip
import get_maximal_mip_version
187 from bt2
.plugin
import find_plugins_in_path
188 from bt2
.plugin
import find_plugins
189 from bt2
.plugin
import find_plugin
190 from bt2
.py_plugin
import plugin_component_class
191 from bt2
.py_plugin
import register_plugin
192 from bt2
.query_executor
import QueryExecutor
193 from bt2
.trace_collection_message_iterator
import AutoSourceComponentSpec
194 from bt2
.trace_collection_message_iterator
import ComponentSpec
195 from bt2
.trace_collection_message_iterator
import TraceCollectionMessageIterator
196 from bt2
.value
import create_value
197 from bt2
.value
import BoolValue
198 from bt2
.value
import _IntegerValue
199 from bt2
.value
import UnsignedIntegerValue
200 from bt2
.value
import SignedIntegerValue
201 from bt2
.value
import RealValue
202 from bt2
.value
import StringValue
203 from bt2
.value
import ArrayValue
204 from bt2
.value
import MapValue
205 from bt2
.value
import _BoolValueConst
206 from bt2
.value
import _IntegerValueConst
207 from bt2
.value
import _UnsignedIntegerValueConst
208 from bt2
.value
import _SignedIntegerValueConst
209 from bt2
.value
import _RealValueConst
210 from bt2
.value
import _StringValueConst
211 from bt2
.value
import _ArrayValueConst
212 from bt2
.value
import _MapValueConst
213 from bt2
.version
import __version__
215 if (sys
.version_info
.major
, sys
.version_info
.minor
) != (3, 4):
217 def _del_global_name(name
):
218 if name
in globals():
221 # remove private module names from the package
222 _del_global_name('_native_bt')
223 _del_global_name('clock_class')
224 _del_global_name('clock_snapshot')
225 _del_global_name('component')
226 _del_global_name('connection')
227 _del_global_name('error')
228 _del_global_name('event')
229 _del_global_name('event_class')
230 _del_global_name('field')
231 _del_global_name('field_class')
232 _del_global_name('field_path')
233 _del_global_name('graph')
234 _del_global_name('integer_range_set')
235 _del_global_name('interrupter')
236 _del_global_name('logging')
237 _del_global_name('message')
238 _del_global_name('message_iterator')
239 _del_global_name('native_bt')
240 _del_global_name('object')
241 _del_global_name('packet')
242 _del_global_name('plugin')
243 _del_global_name('port')
244 _del_global_name('py_plugin')
245 _del_global_name('query_executor')
246 _del_global_name('stream')
247 _del_global_name('stream_class')
248 _del_global_name('trace')
249 _del_global_name('trace_class')
250 _del_global_name('trace_collection_message_iterator')
251 _del_global_name('utils')
252 _del_global_name('value')
253 _del_global_name('version')
255 # remove private `_del_global_name` name from the package
259 # remove sys module name from the package
263 class _MemoryError(_Error
):
264 '''Raised when an operation fails due to memory issues.'''
267 class UnknownObject(Exception):
269 Raised when a component class handles a query for an object it doesn't
276 class _OverflowError(_Error
, OverflowError):
280 class TryAgain(Exception):
284 class Stop(StopIteration):
288 class _IncompleteUserClass(Exception):
292 def _init_and_register_exit():
293 from bt2
import native_bt
296 atexit
.register(native_bt
.bt2_exit_handler
)
297 native_bt
.bt2_init_from_bt2()
300 _init_and_register_exit()
302 # remove private `_init_and_register_exit` name from the package
303 del _init_and_register_exit