| 1 | # The MIT License (MIT) |
| 2 | # |
| 3 | # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
| 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 | |
| 23 | __version__ = '@PACKAGE_VERSION@' |
| 24 | |
| 25 | |
| 26 | from bt2.clock_class import ClockClassOffset |
| 27 | from bt2.clock_snapshot import _ClockSnapshot |
| 28 | from bt2.clock_snapshot import _UnknownClockSnapshot |
| 29 | from bt2.component import _SourceComponentClass |
| 30 | from bt2.component import _FilterComponentClass |
| 31 | from bt2.component import _SinkComponentClass |
| 32 | from bt2.component import _SourceComponent |
| 33 | from bt2.component import _FilterComponent |
| 34 | from bt2.component import _SinkComponent |
| 35 | from bt2.component import _UserSourceComponent |
| 36 | from bt2.component import _UserFilterComponent |
| 37 | from bt2.component import _UserSinkComponent |
| 38 | from bt2.error import ComponentClassType |
| 39 | from bt2.error import _ErrorCause |
| 40 | from bt2.error import _ComponentErrorCause |
| 41 | from bt2.error import _ComponentClassErrorCause |
| 42 | from bt2.error import _MessageIteratorErrorCause |
| 43 | from bt2.error import _Error |
| 44 | from bt2.event_class import EventClassLogLevel |
| 45 | from bt2.field import _IntegerField |
| 46 | from bt2.field import _UnsignedIntegerField |
| 47 | from bt2.field import _SignedIntegerField |
| 48 | from bt2.field import _RealField |
| 49 | from bt2.field import _EnumerationField |
| 50 | from bt2.field import _UnsignedEnumerationField |
| 51 | from bt2.field import _SignedEnumerationField |
| 52 | from bt2.field import _StringField |
| 53 | from bt2.field import _StructureField |
| 54 | from bt2.field import _VariantField |
| 55 | from bt2.field import _ArrayField |
| 56 | from bt2.field import _StaticArrayField |
| 57 | from bt2.field import _DynamicArrayField |
| 58 | from bt2.field_class import IntegerDisplayBase |
| 59 | from bt2.field_class import _IntegerFieldClass |
| 60 | from bt2.field_class import _UnsignedIntegerFieldClass |
| 61 | from bt2.field_class import _SignedIntegerFieldClass |
| 62 | from bt2.field_class import _RealFieldClass |
| 63 | from bt2.field_class import _EnumerationFieldClass |
| 64 | from bt2.field_class import _UnsignedEnumerationFieldClass |
| 65 | from bt2.field_class import _SignedEnumerationFieldClass |
| 66 | from bt2.field_class import _StringFieldClass |
| 67 | from bt2.field_class import _StructureFieldClass |
| 68 | from bt2.field_class import _VariantFieldClass |
| 69 | from bt2.field_class import _VariantFieldClassWithoutSelector |
| 70 | from bt2.field_class import _VariantFieldClassWithSelector |
| 71 | from bt2.field_class import _VariantFieldClassWithUnsignedSelector |
| 72 | from bt2.field_class import _VariantFieldClassWithSignedSelector |
| 73 | from bt2.field_class import _ArrayFieldClass |
| 74 | from bt2.field_class import _StaticArrayFieldClass |
| 75 | from bt2.field_class import _DynamicArrayFieldClass |
| 76 | from bt2.field_path import Scope |
| 77 | from bt2.field_path import _IndexFieldPathItem |
| 78 | from bt2.field_path import _CurrentArrayElementFieldPathItem |
| 79 | from bt2.graph import Graph |
| 80 | from bt2.integer_range_set import SignedIntegerRange |
| 81 | from bt2.integer_range_set import UnsignedIntegerRange |
| 82 | from bt2.integer_range_set import SignedIntegerRangeSet |
| 83 | from bt2.integer_range_set import UnsignedIntegerRangeSet |
| 84 | from bt2.interrupter import Interrupter |
| 85 | from bt2.logging import LoggingLevel |
| 86 | from bt2.logging import get_minimal_logging_level |
| 87 | from bt2.logging import get_global_logging_level |
| 88 | from bt2.logging import set_global_logging_level |
| 89 | from bt2.message import _EventMessage |
| 90 | from bt2.message import _PacketBeginningMessage |
| 91 | from bt2.message import _PacketEndMessage |
| 92 | from bt2.message import _StreamBeginningMessage |
| 93 | from bt2.message import _StreamEndMessage |
| 94 | from bt2.message import _MessageIteratorInactivityMessage |
| 95 | from bt2.message import _DiscardedEventsMessage |
| 96 | from bt2.message import _DiscardedPacketsMessage |
| 97 | from bt2.message_iterator import _UserMessageIterator |
| 98 | from bt2.plugin import find_plugins_in_path |
| 99 | from bt2.plugin import find_plugins |
| 100 | from bt2.plugin import find_plugin |
| 101 | from bt2.py_plugin import plugin_component_class |
| 102 | from bt2.py_plugin import register_plugin |
| 103 | from bt2.query_executor import QueryExecutor |
| 104 | from bt2.trace_collection_message_iterator import ComponentSpec |
| 105 | from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator |
| 106 | from bt2.value import create_value |
| 107 | from bt2.value import BoolValue |
| 108 | from bt2.value import _IntegerValue |
| 109 | from bt2.value import UnsignedIntegerValue |
| 110 | from bt2.value import SignedIntegerValue |
| 111 | from bt2.value import RealValue |
| 112 | from bt2.value import StringValue |
| 113 | from bt2.value import ArrayValue |
| 114 | from bt2.value import MapValue |
| 115 | |
| 116 | |
| 117 | class _MemoryError(_Error): |
| 118 | '''Raised when an operation fails due to memory issues.''' |
| 119 | |
| 120 | |
| 121 | class InvalidObject(Exception): |
| 122 | pass |
| 123 | |
| 124 | |
| 125 | class OverflowError(OverflowError): |
| 126 | pass |
| 127 | |
| 128 | |
| 129 | class TryAgain(Exception): |
| 130 | pass |
| 131 | |
| 132 | |
| 133 | class Stop(StopIteration): |
| 134 | pass |
| 135 | |
| 136 | |
| 137 | class IncompleteUserClass(Exception): |
| 138 | pass |
| 139 | |
| 140 | |
| 141 | class _ListenerHandle: |
| 142 | def __init__(self, listener_id, obj): |
| 143 | self._listener_id = listener_id |
| 144 | self._obj = obj |
| 145 | |
| 146 | |
| 147 | def _init_and_register_exit(): |
| 148 | import bt2.native_bt as _native_bt |
| 149 | import atexit |
| 150 | |
| 151 | atexit.register(_native_bt.bt2_cc_exit_handler) |
| 152 | version = ( |
| 153 | _native_bt.version_get_major(), |
| 154 | _native_bt.version_get_minor(), |
| 155 | _native_bt.version_get_patch(), |
| 156 | _native_bt.version_get_extra(), |
| 157 | ) |
| 158 | _native_bt.bt2_cc_init_from_bt2() |
| 159 | |
| 160 | |
| 161 | _init_and_register_exit() |
| 162 | |
| 163 | |
| 164 | try: |
| 165 | del native_bt |
| 166 | except: |
| 167 | pass |