Re: Conditionally removing signature
Hi,
If you find this too OT, please accept my apolgies and ignore it. I will try to
ask somewhere "pythonic".
Rocco Rutte wrote on 09.07.09:
> #!/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)
I havn't gotten it to work yet. Could the regex be the culprit?
A test with
bash$ gpg --with-colons --list-keys | grep '^[^<]+<([^>]+)>.*'
doesn't find any lines.
And the script prints the resulting strings to stdout and not to the "config
file" as Rocco wrote - right?
jan
--
Bitte beachten Sie auch die Rückseite dieses Schreibens!