from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals

import gpg
import support

support.init_gpgme(gpg.constants.protocol.OpenPGP)
c = gpg.Context()

def dump_item(item):
    print("l={} k={} t={} o={} v={} u={}".format(
        item.level, item.keyid, item.type, item.owner_trust,
        item.validity, item.name))

c.op_trustlist_start("alice", 0)
while True:
    item = c.op_trustlist_next()
    if not item:
        break
    dump_item(item)
c.op_trustlist_end()

for item in c.op_trustlist_all("alice", 0):
    dump_item(item)
