Esempio n. 1
0
def getTrackers(fullpath):
    """retrieve a tracker and its associated code.

    The tracker is not instantiated.

    returns a tuple (code, tracker, module, flag).

    The flag indicates whether that tracker is derived from the
    tracker base class. If False, that tracker will not be listed
    as an available tracker, though it might be specified at the
    command line.
    """

    name, cls = os.path.splitext(fullpath)
    # remove leading '.'
    cls = cls[1:]

    module_name = os.path.basename(name)
    module, pathname = Utils.getModule(name)
    trackers = []

    for name in dir(module):
        obj = getattr(module, name)

        try:
            if Utils.isClass(obj):
                trackers.append((name, obj, module_name, True))
            else:
                trackers.append((name, obj, module_name, False))
        except ValueError:
            pass

    return trackers