bt2: make bt2.Error wrap current thread's error
[babeltrace.git] / src / bindings / python / bt2 / bt2 / __init__.py.in
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 *
27 from bt2.clock_snapshot import *
28 from bt2.component import *
29 from bt2.component import _FilterComponent
30 from bt2.component import _GenericFilterComponentClass
31 from bt2.component import _GenericSinkComponentClass
32 from bt2.component import _GenericSourceComponentClass
33 from bt2.component import _SinkComponent
34 from bt2.component import _SourceComponent
35 from bt2.component import _UserFilterComponent
36 from bt2.component import _UserSinkComponent
37 from bt2.component import _UserSourceComponent
38 from bt2.connection import *
39 from bt2.connection import _Connection
40 from bt2.error import *
41 from bt2.event import _Event
42 from bt2.event_class import *
43 from bt2.field_class import *
44 from bt2.field_path import *
45 from bt2.field import *
46 from bt2.graph import *
47 from bt2.integer_range_set import *
48 from bt2.logging import *
49 from bt2.message import *
50 from bt2.message import _DiscardedEventsMessage
51 from bt2.message import _DiscardedPacketsMessage
52 from bt2.message import _EventMessage
53 from bt2.message_iterator import *
54 from bt2.message_iterator import _UserMessageIterator
55 from bt2.packet import _Packet
56 from bt2.plugin import *
57 from bt2.port import *
58 from bt2.py_plugin import *
59 from bt2.query_executor import *
60 from bt2.stream import _Stream
61 from bt2.stream_class import *
62 from bt2.trace import *
63 from bt2.trace_class import *
64 from bt2.trace_collection_message_iterator import *
65 from bt2.value import *
66 from bt2.value import _Value
67 from bt2.value import _IntegerValue
68 from bt2.clock_snapshot import _UnknownClockSnapshot
69
70
71 class CreationError(Error):
72 '''Raised when object creation fails due to memory issues.'''
73
74
75 class InvalidObject(Exception):
76 pass
77
78
79 class InvalidParams(Exception):
80 pass
81
82
83 class OverflowError(OverflowError):
84 pass
85
86
87 class Unsupported(Exception):
88 pass
89
90
91 class TryAgain(Exception):
92 pass
93
94
95 class Stop(StopIteration):
96 pass
97
98
99 class IncompleteUserClass(Exception):
100 pass
101
102
103 class Canceled(Exception):
104 pass
105
106
107 class NonexistentClockSnapshot(Exception):
108 pass
109
110
111 class LoadingError(Error):
112 pass
113
114
115 class _ListenerHandle:
116 def __init__(self, listener_id, obj):
117 self._listener_id = listener_id
118 self._obj = obj
119
120
121 def _init_and_register_exit():
122 import bt2.native_bt as _native_bt
123 import atexit
124
125 atexit.register(_native_bt.bt2_cc_exit_handler)
126 version = (
127 _native_bt.version_get_major(),
128 _native_bt.version_get_minor(),
129 _native_bt.version_get_patch(),
130 _native_bt.version_get_extra(),
131 )
132 _native_bt.bt2_cc_init_from_bt2()
133
134
135 _init_and_register_exit()
136
137
138 try:
139 del native_bt
140 except:
141 pass
This page took 0.033296 seconds and 4 git commands to generate.