babeltrace: Remove leftovers
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 30 Apr 2019 22:00:43 +0000 (18:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:40 +0000 (18:19 -0400)
It seems like these files should have been removed when removing the
babeltrace Python bindings in commit

    1c81bd8895c0 ("Remove babeltrace 1 Python bindings and tests")

Right now, the test causes a "make check" failure, because it tries to
import the babeltrace Python package, which no longer exists.

Change-Id: Ied4871ec23444776fca601b6f78b583ef8137c81
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1125
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bindings/python/babeltrace/babeltrace/reader.py [deleted file]
bindings/python/babeltrace/babeltrace/reader_event_declaration.py [deleted file]
bindings/python/babeltrace/babeltrace/reader_field_declaration.py [deleted file]
bindings/python/babeltrace/babeltrace/reader_field_definition.py [deleted file]
bindings/python/babeltrace/babeltrace/reader_trace_collection.py [deleted file]
tests/bindings/python/babeltrace/test_reader_event_declaration.py [deleted file]

diff --git a/bindings/python/babeltrace/babeltrace/reader.py b/bindings/python/babeltrace/babeltrace/reader.py
deleted file mode 100644 (file)
index 42c20e0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2013-2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import babeltrace.common as common
-from babeltrace.reader_event_declaration import *
-from babeltrace.reader_event import *
-from babeltrace.reader_field_declaration import *
-from babeltrace.reader_field_definition import *
-from babeltrace.reader_trace_collection import *
-from babeltrace.reader_trace_handle import *
-
-
-# Based on enum bt_clock_type in clock-type.h
-class _ClockType:
-    CLOCK_CYCLES = 0
-    CLOCK_REAL = 1
diff --git a/bindings/python/babeltrace/babeltrace/reader_event_declaration.py b/bindings/python/babeltrace/babeltrace/reader_event_declaration.py
deleted file mode 100644 (file)
index a88f37c..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2013-2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import bt2
-import babeltrace.common as common
-import babeltrace.reader_field_declaration as field_declaration
-import collections
-
-
-def _create_event_declaration(event_class):
-    event_declaration = EventDeclaration.__new__(EventDeclaration)
-    event_declaration._event_class = event_class
-    return event_declaration
-
-
-class EventDeclaration:
-    """
-    An event declaration contains the properties of a class of events,
-    that is, the common properties and fields layout of all the actual
-    recorded events associated with this declaration.
-
-    This class is not meant to be instantiated by the user. It is
-    returned by :attr:`TraceHandle.events`.
-    """
-    def __init__(self):
-        raise NotImplementedError("EventDeclaration cannot be instantiated")
-
-    def _get_scope_field_type(self, scope):
-        try:
-            ec = self._event_class
-            if scope is common.CTFScope.EVENT_FIELDS:
-                return ec.payload_field_type
-
-            if scope is common.CTFScope.EVENT_CONTEXT:
-                return ec.context_field_type
-
-            if scope is common.CTFScope.STREAM_EVENT_CONTEXT:
-                return ec.stream_class.event_context_field_type
-
-            if scope is common.CTFScope.STREAM_EVENT_HEADER:
-                return ec.stream_class.event_header_field_type
-
-            if scope is common.CTFScope.STREAM_PACKET_CONTEXT:
-                return ec.stream_class.packet_context_field_type
-
-            if scope is common.CTFScope.TRACE_PACKET_HEADER:
-                return ec.stream_class.trace.packet_header_field_type
-        except bt2.Error:
-            return
-
-        raise ValueError("Invalid scope provided")
-
-    @property
-    def name(self):
-        """
-        Event name, or ``None`` on error.
-        """
-
-        return self._event_class.name
-
-    @property
-    def id(self):
-        """
-        Event numeric ID, or -1 on error.
-        """
-
-        return self._event_class.id
-
-    @property
-    def fields(self):
-        """
-        Generates all the field declarations of this event, going
-        through each scope in the following order:
-
-        1. Event fields (:attr:`babeltrace.common.CTFScope.EVENT_FIELDS`)
-        2. Event context (:attr:`babeltrace.common.CTFScope.EVENT_CONTEXT`)
-        3. Stream event context (:attr:`babeltrace.common.CTFScope.STREAM_EVENT_CONTEXT`)
-        4. Event header (:attr:`babeltrace.common.CTFScope.STREAM_EVENT_HEADER`)
-        5. Packet context (:attr:`babeltrace.common.CTFScope.STREAM_PACKET_CONTEXT`)
-        6. Packet header (:attr:`babeltrace.common.CTFScope.TRACE_PACKET_HEADER`)
-
-        All the generated field declarations inherit
-        :class:`FieldDeclaration`, and are among:
-
-        * :class:`IntegerFieldDeclaration`
-        * :class:`FloatFieldDeclaration`
-        * :class:`EnumerationFieldDeclaration`
-        * :class:`StringFieldDeclaration`
-        * :class:`ArrayFieldDeclaration`
-        * :class:`SequenceFieldDeclaration`
-        * :class:`StructureFieldDeclaration`
-        * :class:`VariantFieldDeclaration`
-        """
-
-        for scope in _SCOPES:
-            for declaration in self.fields_scope(scope):
-                yield declaration
-
-    def fields_scope(self, scope):
-        """
-        Generates all the field declarations of the event's scope
-        *scope*.
-
-        *scope* must be one of :class:`babeltrace.common.CTFScope` constants.
-
-        All the generated field declarations inherit
-        :class:`FieldDeclaration`, and are among:
-
-        * :class:`IntegerFieldDeclaration`
-        * :class:`FloatFieldDeclaration`
-        * :class:`EnumerationFieldDeclaration`
-        * :class:`StringFieldDeclaration`
-        * :class:`ArrayFieldDeclaration`
-        * :class:`SequenceFieldDeclaration`
-        * :class:`StructureFieldDeclaration`
-        * :class:`VariantFieldDeclaration`
-        """
-
-        scope_field_type = self._get_scope_field_type(scope)
-        for name, field_type in scope_field_type.items():
-            yield field_declaration._create_field_declaration(field_type, name,
-                                                              scope)
-
-
-# Priority of the scopes when searching for event fields
-_SCOPES = [
-    common.CTFScope.EVENT_FIELDS,
-    common.CTFScope.EVENT_CONTEXT,
-    common.CTFScope.STREAM_EVENT_CONTEXT,
-    common.CTFScope.STREAM_EVENT_HEADER,
-    common.CTFScope.STREAM_PACKET_CONTEXT,
-    common.CTFScope.TRACE_PACKET_HEADER
-]
diff --git a/bindings/python/babeltrace/babeltrace/reader_field_declaration.py b/bindings/python/babeltrace/babeltrace/reader_field_declaration.py
deleted file mode 100644 (file)
index aa4f75c..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2013-2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import bt2
-import babeltrace.common as common
-
-
-def _create_field_declaration(field_type, name, scope):
-    try:
-        if type(field_type) == bt2.IntegerFieldType:
-            declaration = IntegerFieldDeclaration.__new__(
-                IntegerFieldDeclaration)
-        elif type(field_type) == bt2.EnumerationFieldType:
-            declaration = EnumerationFieldDeclaration.__new__(
-                EnumerationFieldDeclaration)
-        elif type(field_type) == bt2.ArrayFieldType:
-            declaration = ArrayFieldDeclaration.__new__(
-                ArrayFieldDeclaration)
-        elif type(field_type) == bt2.SequenceFieldType:
-            declaration = SequenceFieldDeclaration.__new__(
-                SequenceFieldDeclaration)
-        elif type(field_type) == bt2.FloatingPointNumberFieldType:
-            declaration = FloatFieldDeclaration.__new__(
-                FloatFieldDeclaration)
-        elif type(field_type) == bt2.StructureFieldType:
-            declaration = StructureFieldDeclaration.__new__(
-                StructureFieldDeclaration)
-        elif type(field_type) == bt2.StringFieldType:
-            declaration = StringFieldDeclaration.__new__(
-                StringFieldDeclaration)
-        elif type(field_type) == bt2.VariantFieldType:
-            declaration = VariantFieldDeclaration.__new__(
-                VariantFieldDeclaration)
-        else:
-            return
-    except bt2.Error:
-        return
-
-    declaration._field_type = field_type
-    declaration._name = name
-    declaration._scope = scope
-    return declaration
-
-
-class FieldDeclaration:
-    """
-    Base class for concrete field declarations.
-
-    This class is not meant to be instantiated by the user.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("FieldDeclaration cannot be instantiated")
-
-    def __repr__(self):
-        return "({0}) {1} {2}".format(common.CTFScope.scope_name(self.scope),
-                                      common.CTFTypeId.type_name(self.type),
-                                      self.name)
-
-    @property
-    def name(self):
-        """
-        Field name, or ``None`` on error.
-        """
-
-        return self._name
-
-    @property
-    def type(self):
-        """
-        Field type (one of :class:`babeltrace.common.CTFTypeId`
-        constants).
-        """
-
-        return _OBJ_TO_TYPE_ID[type(self)]
-
-    @property
-    def scope(self):
-        """
-        Field scope (one of:class:`babeltrace.common.CTFScope`
-        constants).
-        """
-
-        return self._scope
-
-
-class IntegerFieldDeclaration(FieldDeclaration):
-    """
-    Integer field declaration.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("IntegerFieldDeclaration cannot be instantiated")
-
-    @property
-    def signedness(self):
-        """
-        0 if this integer is unsigned, 1 if signed, or -1 on error.
-        """
-
-        try:
-            if self._field_type.is_signed:
-                return 1
-            else:
-                return 0
-        except bt2.Error:
-            return -1
-
-    @property
-    def base(self):
-        """
-        Integer base (:class:`int`), or a negative value on error.
-        """
-
-        try:
-            return self._field_type.base
-        except AssertionError:
-            return -1
-
-    @property
-    def byte_order(self):
-        """
-        Integer byte order (one of
-        :class:`babeltrace.common.ByteOrder` constants).
-        """
-
-        try:
-            byte_order = self._field_type.byte_order
-        except AssertionError:
-            return common.ByteOrder.BYTE_ORDER_UNKNOWN
-
-        try:
-            return _BT2_BYTE_ORDER_TO_BYTE_ORDER[byte_order]
-        except KeyError:
-            return common.ByteOrder.BYTE_ORDER_UNKNOWN
-
-    @property
-    def size(self):
-        """
-        Integer size in bits, or a negative value on error.
-        """
-
-        try:
-            return self._field_type.size
-        except AssertionError:
-            return -1
-
-    @property
-    def length(self):
-        """
-        Integer size in bits, or a negative value on error.
-        """
-
-        return self.size
-
-    @property
-    def encoding(self):
-        """
-        Integer encoding (one of
-        :class:`babeltrace.common.CTFStringEncoding` constants).
-        """
-
-        try:
-            encoding = self._field_type.encoding
-        except bt2.Error:
-            return common.CTFStringEncoding.UNKNOWN
-
-        try:
-            return _BT2_ENCODING_TO_ENCODING[encoding]
-        except KeyError:
-            return common.CTFStringEncoding.UNKNOWN
-
-
-class EnumerationFieldDeclaration(FieldDeclaration):
-    """
-    Enumeration field declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("EnumerationFieldDeclaration cannot be instantiated")
-
-
-class ArrayFieldDeclaration(FieldDeclaration):
-    """
-    Static array field declaration.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("ArrayFieldDeclaration cannot be instantiated")
-
-    @property
-    def length(self):
-        """
-        Fixed length of this static array (number of contained
-        elements), or a negative value on error.
-        """
-
-        try:
-            return self._field_type.length
-        except AssertionError:
-            return -1
-
-    @property
-    def element_declaration(self):
-        """
-        Field declaration of the underlying element.
-        """
-
-        try:
-            return _create_field_declaration(
-                self._field_type.element_field_type, name=None,
-                scope=self._scope)
-        except bt2.Error:
-            return
-
-
-class SequenceFieldDeclaration(FieldDeclaration):
-    """
-    Sequence (dynamic array) field declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("SequenceFieldDeclaration cannot be instantiated")
-
-    @property
-    def element_declaration(self):
-        """
-        Field declaration of the underlying element.
-        """
-
-        try:
-            return _create_field_declaration(
-                self._field_type.element_field_type, name=None,
-                scope=self._scope)
-        except bt2.Error:
-            return
-
-
-class FloatFieldDeclaration(FieldDeclaration):
-    """
-    Floating point number field declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("FloatFieldDeclaration cannot be instantiated")
-
-
-class StructureFieldDeclaration(FieldDeclaration):
-    """
-    Structure (ordered map of field names to field declarations) field
-    declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("StructureFieldDeclaration cannot be instantiated")
-
-
-class StringFieldDeclaration(FieldDeclaration):
-    """
-    String (NULL-terminated array of bytes) field declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("StringFieldDeclaration cannot be instantiated")
-
-
-class VariantFieldDeclaration(FieldDeclaration):
-    """
-    Variant (dynamic selection between different types) field declaration.
-
-    .. note::
-
-       As of this version, this class is missing some properties.
-    """
-
-    def __init__(self):
-        raise NotImplementedError("VariantFieldDeclaration cannot be instantiated")
-
-
-_OBJ_TO_TYPE_ID = {
-    IntegerFieldDeclaration: common.CTFTypeId.INTEGER,
-    FloatFieldDeclaration: common.CTFTypeId.FLOAT,
-    EnumerationFieldDeclaration: common.CTFTypeId.ENUM,
-    StringFieldDeclaration: common.CTFTypeId.STRING,
-    StructureFieldDeclaration: common.CTFTypeId.STRUCT,
-    ArrayFieldDeclaration: common.CTFTypeId.ARRAY,
-    SequenceFieldDeclaration: common.CTFTypeId.SEQUENCE,
-    VariantFieldDeclaration: common.CTFTypeId.VARIANT,
-}
-
-_BT2_BYTE_ORDER_TO_BYTE_ORDER = {
-    bt2.ByteOrder.NATIVE: common.ByteOrder.BYTE_ORDER_NATIVE,
-    bt2.ByteOrder.LITTLE_ENDIAN: common.ByteOrder.BYTE_ORDER_LITTLE_ENDIAN,
-    bt2.ByteOrder.BIG_ENDIAN: common.ByteOrder.BYTE_ORDER_BIG_ENDIAN,
-    bt2.ByteOrder.NETWORK: common.ByteOrder.BYTE_ORDER_NETWORK,
-}
-
-_BT2_ENCODING_TO_ENCODING = {
-    bt2.Encoding.NONE: common.CTFStringEncoding.NONE,
-    bt2.Encoding.ASCII: common.CTFStringEncoding.ASCII,
-    bt2.Encoding.UTF8: common.CTFStringEncoding.UTF8,
-}
diff --git a/bindings/python/babeltrace/babeltrace/reader_field_definition.py b/bindings/python/babeltrace/babeltrace/reader_field_definition.py
deleted file mode 100644 (file)
index 278ca00..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2013-2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import bt2
-import babeltrace.common as common
-import babeltrace.reader_field_declaration as reader_field_declaration
-
-
-class FieldError(Exception):
-    """
-    Field error, raised when the value of a field cannot be accessed.
-    """
-
-    def __init__(self, value):
-        self.value = value
-
-    def __str__(self):
-        return repr(self.value)
-
-
-class _Definition:
-    def __init__(self, scope_id, field, name):
-        self._scope_id = scope_id
-        self._field = field
-        self._name = name
-
-    @property
-    def name(self):
-        """Return the name of a field or None on error."""
-
-        return self._name
-
-    @property
-    def type(self):
-        """Return the type of a field or -1 if unknown."""
-
-        try:
-            return _OBJ_TO_TYPE_ID[type(self._field)]
-        except KeyError:
-            return -1
-
-    @property
-    def declaration(self):
-        """Return the associated Definition object."""
-
-        return reader_field_declaration._create_field_declaration(
-            self._field.field_type, self._name, self.scope)
-
-    @property
-    def value(self):
-        """
-        Return the value associated with the field according to its type.
-        Return None on error.
-        """
-
-        try:
-            if type(self._field) in (bt2._ArrayField, bt2._SequenceField):
-                elem_ft = self._field.field_type.element_field_type
-
-                if type(elem_ft) is bt2.IntegerFieldType:
-                    if elem_ft.size == 8 and elem_ft.encoding != bt2.Encoding.NONE:
-                        return bytes(x for x in self._field._value if x != 0).decode()
-
-            return self._field._value
-        except bt2.Error:
-            return
-
-    @property
-    def scope(self):
-        """Return the scope of a field or None on error."""
-
-        return self._scope_id
-
-
-_OBJ_TO_TYPE_ID = {
-    bt2._IntegerField: common.CTFTypeId.INTEGER,
-    bt2._FloatingPointNumberField: common.CTFTypeId.FLOAT,
-    bt2._EnumerationField: common.CTFTypeId.ENUM,
-    bt2._StringField: common.CTFTypeId.STRING,
-    bt2._StructureField: common.CTFTypeId.STRUCT,
-    bt2._ArrayField: common.CTFTypeId.ARRAY,
-    bt2._SequenceField: common.CTFTypeId.SEQUENCE,
-    bt2._VariantField: common.CTFTypeId.VARIANT,
-}
diff --git a/bindings/python/babeltrace/babeltrace/reader_trace_collection.py b/bindings/python/babeltrace/babeltrace/reader_trace_collection.py
deleted file mode 100644 (file)
index e6544a8..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2013-2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import bt2
-import babeltrace.common as common
-from babeltrace import reader_trace_handle
-from babeltrace import reader_event
-import os
-
-
-class TraceCollection:
-    """
-    A :class:`TraceCollection` is a collection of opened traces.
-
-    Once a trace collection is created, you can add traces to the
-    collection by using the :meth:`add_trace` or
-    :meth:`add_traces_recursive`, and then iterate on the merged
-    events using :attr:`events`.
-
-    You may use :meth:`remove_trace` to close and remove a specific
-    trace from a trace collection.
-    """
-
-    def __init__(self, intersect_mode=False):
-        """
-        Creates an empty trace collection.
-        """
-
-        self._intersect_mode = intersect_mode
-        self._trace_handles = set()
-        self._next_th_id = 0
-        self._ctf_plugin = bt2.find_plugin('ctf')
-        assert(self._ctf_plugin is not None)
-        self._fs_comp_cls = self._ctf_plugin.source_component_classes['fs']
-
-    def add_trace(self, path, format_str):
-        """
-        Adds a trace to the trace collection.
-
-        *path* is the exact path of the trace on the filesystem.
-
-        *format_str* is a string indicating the type of trace to
-        add. ``ctf`` is currently the only supported trace format.
-
-        Returns the corresponding :class:`TraceHandle` instance for
-        this opened trace on success, or ``None`` on error.
-
-        This function **does not** recurse directories to find a
-        trace.  See :meth:`add_traces_recursive` for a recursive
-        version of this function.
-        """
-
-        if format_str != 'ctf':
-            raise ValueError('only the "ctf" format is supported')
-
-        if not os.path.isfile(os.path.join(path, 'metadata')):
-            raise ValueError('no "metadata" file found in "{}"'.format(path))
-
-        th = reader_trace_handle.TraceHandle.__new__(reader_trace_handle.TraceHandle)
-        th._id = self._next_th_id
-        self._next_th_id += 1
-        th._trace_collection = self
-        th._path = path
-        self._trace_handles.add(th)
-        return th
-
-    def add_traces_recursive(self, path, format_str):
-        """
-        Adds traces to this trace collection by recursively searching
-        in the *path* directory.
-
-        *format_str* is a string indicating the type of trace to add.
-        ``ctf`` is currently the only supported trace format.
-
-        Returns a :class:`dict` object mapping full paths to trace
-        handles for each trace found, or ``None`` on error.
-
-        See also :meth:`add_trace`.
-        """
-
-        trace_handles = {}
-        noTrace = True
-        error = False
-
-        for fullpath, dirs, files in os.walk(path):
-            if "metadata" in files:
-                trace_handle = self.add_trace(fullpath, format_str)
-
-                if trace_handle is None:
-                    error = True
-                    continue
-
-                trace_handles[fullpath] = trace_handle
-                noTrace = False
-
-        if noTrace and error:
-            return None
-
-        return trace_handles
-
-    def remove_trace(self, handle):
-        """
-        Removes a trace from the trace collection using its trace
-        handle *trace_handle*.
-
-        :class:`TraceHandle` objects are returned by :meth:`add_trace`
-        and :meth:`add_traces_recursive`.
-        """
-
-        if not isinstance(handle, reader_trace_handle.TraceHandle):
-            raise TypeError("'{}' is not a 'TraceHandle' object".format(
-                handle.__class__.__name__))
-
-        # this can raise but it would mean the trace handle is not part
-        # of this trace collection anyway
-        self._trace_handles.remove(handle)
-
-    @property
-    def intersect_mode(self):
-        return self._intersect_mode
-
-    @property
-    def has_intersection(self):
-        return any(th._has_intersection for th in self._trace_handles)
-
-    @property
-    def events(self):
-        """
-        Generates the ordered :class:`Event` objects of all the opened
-        traces contained in this trace collection.
-        """
-
-        return self._gen_events()
-
-    def events_timestamps(self, timestamp_begin, timestamp_end):
-        """
-        Generates the ordered :class:`Event` objects of all the opened
-        traces contained in this trace collection from *timestamp_begin*
-        to *timestamp_end*.
-
-        *timestamp_begin* and *timestamp_end* are given in nanoseconds
-        since Epoch.
-
-        See :attr:`events` for notes and limitations.
-        """
-
-        return self._gen_events(timestamp_begin / 1e9, timestamp_end / 1e9)
-
-    def _gen_events(self, begin_s=None, end_s=None):
-        specs = [bt2.ComponentSpec('ctf', 'fs', th.path) for th in self._trace_handles]
-
-        try:
-            iter_cls = bt2.TraceCollectionMessageIterator
-            tc_iter = iter_cls(specs,
-                               stream_intersection_mode=self._intersect_mode,
-                               begin=begin_s, end=end_s,
-                               message_types=[bt2.EventMessage])
-            return map(reader_event._create_event, tc_iter)
-        except:
-            raise ValueError
-
-    @property
-    def timestamp_begin(self):
-        """
-        Begin timestamp of this trace collection (nanoseconds since Epoch).
-        """
-
-        if not self._trace_handles:
-            return
-
-        return min(th.timestamp_begin for th in self._trace_handles)
-
-    @property
-    def timestamp_end(self):
-        """
-        End timestamp of this trace collection (nanoseconds since Epoch).
-        """
-
-        if not self._trace_handles:
-            return
-
-        return max(th.timestamp_end for th in self._trace_handles)
diff --git a/tests/bindings/python/babeltrace/test_reader_event_declaration.py b/tests/bindings/python/babeltrace/test_reader_event_declaration.py
deleted file mode 100644 (file)
index dc86168..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
-# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-import collections
-import unittest
-import bt2
-import babeltrace
-#import babeltrace.reader_event_declaration as event_declaration
-
-@unittest.skip("this is broken")
-class EventDeclarationTestCase(unittest.TestCase):
-    def setUp(self):
-        self._values = {
-            'ph_field_1' : 42,
-            'ph_field_2' : 'bla bla',
-            'spc_field' : 'some string',
-            'seh_field' : 'another string',
-            'sec_field' : 68752,
-            'ec_field' : 89,
-            'ef_field' : 8476,
-        }
-
-        self._int_ft = bt2.IntegerFieldType(32)
-        self._str_ft = bt2.StringFieldType()
-
-        self._trace = bt2.Trace()
-        self._trace.packet_header_field_type = bt2.StructureFieldType()
-        self._trace.packet_header_field_type += collections.OrderedDict([
-            ('ph_field_1', self._int_ft),
-            ('ph_field_2', self._str_ft),
-        ])
-
-        self._sc = bt2.StreamClass()
-        self._sc.packet_context_field_type = bt2.StructureFieldType()
-        self._sc.packet_context_field_type += collections.OrderedDict([
-            ('spc_field', self._str_ft),
-        ])
-
-        self._sc.event_header_field_type = bt2.StructureFieldType()
-        self._sc.event_header_field_type += collections.OrderedDict([
-            ('seh_field', self._str_ft),
-        ])
-
-        self._sc.event_context_field_type = bt2.StructureFieldType()
-        self._sc.event_context_field_type += collections.OrderedDict([
-            ('sec_field', self._int_ft),
-        ])
-
-        self._clock_class = bt2.ClockClass('allo', 1000)
-        self._trace.add_clock_class(self._clock_class)
-
-        self._ec = bt2.EventClass('event_class_name')
-        self._ec.id = 42
-        self._ec.context_field_type = bt2.StructureFieldType()
-        self._ec.context_field_type += collections.OrderedDict([
-            ('ec_field', self._int_ft),
-        ])
-        self._ec.payload_field_type = bt2.StructureFieldType()
-        self._ec.payload_field_type += collections.OrderedDict([
-            ('ef_field', self._int_ft),
-        ])
-
-        self._sc.add_event_class(self._ec)
-
-        self._trace.add_stream_class(self._sc)
-        self._cc_prio_map = bt2.ClockClassPriorityMap()
-        self._cc_prio_map[self._clock_class] = 231
-        self._stream = self._sc()
-        self._packet = self._stream.create_packet()
-        self._packet.header_field['ph_field_1'] = self._values['ph_field_1']
-        self._packet.header_field['ph_field_2'] = self._values['ph_field_2']
-        self._packet.context_field['spc_field'] = self._values['spc_field']
-
-    def tearDown(self):
-        del self._trace
-        del self._sc
-        del self._ec
-        del self._int_ft
-        del self._str_ft
-        del self._clock_class
-        del self._cc_prio_map
-        del self._stream
-        del self._packet
-
-    def _get_event_declaration(self):
-        return event_declaration._create_event_declaration(self._ec)
-
-    def test_name(self):
-        declaration = self._get_event_declaration()
-        self.assertEqual(declaration.name, 'event_class_name')
-
-    def test_id(self):
-        declaration = self._get_event_declaration()
-        self.assertEqual(declaration.id, 42)
-
-    def test_fields(self):
-        declaration = self._get_event_declaration()
-        fields = declaration.fields
-        self.assertEqual(len(list(fields)), len(self._values))
-
-    def test_fields_scope(self):
-        declaration = self._get_event_declaration()
-        event_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.EVENT_FIELDS))
-        self.assertEqual(len(event_fields), 1)
-        self.assertEqual(event_fields[0].name, 'ef_field')
-        self.assertEqual(event_fields[0].scope,
-                         babeltrace.CTFScope.EVENT_FIELDS)
-
-        event_ctx_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.EVENT_CONTEXT))
-        self.assertEqual(len(event_ctx_fields), 1)
-        self.assertEqual(event_ctx_fields[0].name, 'ec_field')
-        self.assertEqual(event_ctx_fields[0].scope,
-                         babeltrace.CTFScope.EVENT_CONTEXT)
-
-        stream_ectx_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.STREAM_EVENT_CONTEXT))
-        self.assertEqual(len(stream_ectx_fields), 1)
-        self.assertEqual(stream_ectx_fields[0].name, 'sec_field')
-        self.assertEqual(stream_ectx_fields[0].scope,
-                         babeltrace.CTFScope.STREAM_EVENT_CONTEXT)
-
-        stream_eh_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.STREAM_EVENT_HEADER))
-        self.assertEqual(len(stream_eh_fields), 1)
-        self.assertEqual(stream_eh_fields[0].name, 'seh_field')
-        self.assertEqual(stream_eh_fields[0].scope,
-                         babeltrace.CTFScope.STREAM_EVENT_HEADER)
-
-        stream_pctx_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.STREAM_PACKET_CONTEXT))
-        self.assertEqual(len(stream_pctx_fields), 1)
-        self.assertEqual(stream_pctx_fields[0].name, 'spc_field')
-        self.assertEqual(stream_pctx_fields[0].scope,
-                         babeltrace.CTFScope.STREAM_PACKET_CONTEXT)
-
-        stream_ph_fields = list(
-            declaration.fields_scope(babeltrace.CTFScope.TRACE_PACKET_HEADER))
-        self.assertEqual(len(stream_ph_fields), 2)
-        self.assertEqual(stream_ph_fields[0].name, 'ph_field_1')
-        self.assertEqual(stream_ph_fields[0].scope,
-                         babeltrace.CTFScope.TRACE_PACKET_HEADER)
-        self.assertEqual(stream_ph_fields[1].name, 'ph_field_2')
-        self.assertEqual(stream_ph_fields[1].scope,
-                         babeltrace.CTFScope.TRACE_PACKET_HEADER)
This page took 0.034656 seconds and 4 git commands to generate.