Hi, * Kyle Wheeler wrote: > Well, a better idea would, imho, be to use the "group" command, like > so: > > group -group gpg -addr user1@xxxxxxxxxxx \ > user2@xxxxxxxxxxx \ > ... Yes, that's better. Rocco (attaching the script this time)
#!/usr/bin/env python2.6
import subprocess, re
if __name__ == '__main__':
    mail_re = re.compile(r'^[^<]+<([^>]+)>.*')
    a, p = set(), subprocess.Popen(['gpg', '--with-colons', '--list-keys'],
                                   stdout=subprocess.PIPE)
    for line in p.stdout:
        if not line.startswith('uid:'): continue
        m = mail_re.match(line.split(':')[9])
        if not m: continue
        a.add(m.groups(0)[0])
    print 'group -group gpg -addr %s' % ' '.join(a)
Attachment:
pgp9ndRCczaRL.pgp
Description: PGP signature