Remove some more things linked with the gpg plugin
This commit is contained in:
parent
05d1800f81
commit
adbe62a057
3 changed files with 2 additions and 145 deletions
|
@ -1,60 +0,0 @@
|
||||||
'\" t
|
|
||||||
.\" Title: POEZIO_GPG_EXPORT
|
|
||||||
.\" Author: Tanguy Ortolo <tanguy+debian@ortolo.eu>
|
|
||||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
|
||||||
.\" Date: 10/28/2016
|
|
||||||
.\" Manual: User commands
|
|
||||||
.\" Source: Poezio
|
|
||||||
.\" Language: English
|
|
||||||
.\"
|
|
||||||
.TH "POEZIO_GPG_EXPORT" "1" "10/28/2016" "Poezio" "User commands"
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.\" * Define some portability stuff
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
.\" http://bugs.debian.org/507673
|
|
||||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
||||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
.ie \n(.g .ds Aq \(aq
|
|
||||||
.el .ds Aq '
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.\" * set default formatting
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.\" disable hyphenation
|
|
||||||
.nh
|
|
||||||
.\" disable justification (adjust text to left margin only)
|
|
||||||
.ad l
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.\" * MAIN CONTENT STARTS HERE *
|
|
||||||
.\" -----------------------------------------------------------------
|
|
||||||
.SH "NAME"
|
|
||||||
poezio_gpg_export \- Print a key list for the Poezio GPG plugin
|
|
||||||
.SH "SYNOPSIS"
|
|
||||||
.HP \w'\fBpoezio_gpg_export\fR\ 'u
|
|
||||||
\fBpoezio_gpg_export\fR
|
|
||||||
.SH "DESCRIPTION"
|
|
||||||
.PP
|
|
||||||
Poezio
|
|
||||||
is a console\-based XMPP client\&.
|
|
||||||
.PP
|
|
||||||
\fBpoezio_gpg_export\fR
|
|
||||||
uses
|
|
||||||
\fBgpg\fR
|
|
||||||
to build a list suitable for the Poezio GPG plugin\&. Double\-check the output and use at your own risk\&.
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
\fBpoezio\fR(1), \fBgpg\fR(1)
|
|
||||||
.SH "AUTHOR"
|
|
||||||
.PP
|
|
||||||
\fBTanguy Ortolo\fR <\&tanguy+debian@ortolo.eu\&>
|
|
||||||
.RS 4
|
|
||||||
Wrote this manpage for the Debian system.
|
|
||||||
.RE
|
|
||||||
.SH "COPYRIGHT"
|
|
||||||
.br
|
|
||||||
Copyright \(co 2016 Tanguy Ortolo
|
|
||||||
.br
|
|
||||||
.PP
|
|
||||||
This manual page was written for the Debian system (and may be used by others).
|
|
||||||
.PP
|
|
||||||
Permission is granted to copy, distribute and/or modify this document under the terms of the Zlib License.
|
|
||||||
.sp
|
|
|
@ -1,82 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
"""
|
|
||||||
Parses the output of gpg into a list suitable for the poezio
|
|
||||||
GPG plugin. Double-check the output and use at your own risk.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import pprint
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
|
|
||||||
addr_re = re.compile(r'^uid\s+\[\s+full\s+\]\s.*<(.*@.*)>$')
|
|
||||||
id_re = re.compile(r'^pub\s+.*/(........) .*')
|
|
||||||
|
|
||||||
def extract_block(total):
|
|
||||||
"""
|
|
||||||
GPG output blocks are separated by newlines
|
|
||||||
"""
|
|
||||||
if '' in total:
|
|
||||||
index = total.index('')
|
|
||||||
else:
|
|
||||||
index = len(total)
|
|
||||||
block = total[:index]
|
|
||||||
total = total[index+1:]
|
|
||||||
return (block, total)
|
|
||||||
|
|
||||||
def parse_block(blocks, block):
|
|
||||||
"""
|
|
||||||
Keep the blocks with trusted keys
|
|
||||||
and extract addresses and UIDs
|
|
||||||
"""
|
|
||||||
|
|
||||||
uid = ''
|
|
||||||
addrs = []
|
|
||||||
blocksize = len(block)
|
|
||||||
|
|
||||||
for i, line in enumerate(reversed(block)):
|
|
||||||
if line.startswith('uid'):
|
|
||||||
match = addr_re.match(line)
|
|
||||||
if match:
|
|
||||||
addr = match.groups()[0]
|
|
||||||
if addr not in addrs:
|
|
||||||
addrs.append(addr)
|
|
||||||
else:
|
|
||||||
del block[blocksize-1-i]
|
|
||||||
elif line.startswith('pub'):
|
|
||||||
uid = id_re.match(line).groups()[0]
|
|
||||||
|
|
||||||
if addrs:
|
|
||||||
blocks[uid] = addrs
|
|
||||||
|
|
||||||
def output(blocks):
|
|
||||||
print('[keys]')
|
|
||||||
for uid in blocks:
|
|
||||||
for addr in blocks[uid]:
|
|
||||||
print('%s = %s' % (addr, uid))
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
os.putenv('LANG', 'en_US.UTF-8')
|
|
||||||
|
|
||||||
gpg_proc = subprocess.Popen(
|
|
||||||
[
|
|
||||||
"/usr/bin/gpg",
|
|
||||||
"--list-keys",
|
|
||||||
"--list-options",
|
|
||||||
"show-uid-validity"
|
|
||||||
],
|
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
result, _ = gpg_proc.communicate()
|
|
||||||
result = result.decode().strip().splitlines()[2:]
|
|
||||||
blocks = {}
|
|
||||||
|
|
||||||
while result:
|
|
||||||
block, result = extract_block(result)
|
|
||||||
parse_block(blocks, block)
|
|
||||||
output(blocks)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
5
setup.py
5
setup.py
|
@ -117,15 +117,14 @@ setup(name="poezio",
|
||||||
'Programming Language :: Python :: 3 :: Only'],
|
'Programming Language :: Python :: 3 :: Only'],
|
||||||
keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
|
keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'],
|
||||||
packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
|
packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows',
|
||||||
'poezio_plugins', 'poezio_plugins.gpg', 'poezio_themes'],
|
'poezio_plugins', 'poezio_themes'],
|
||||||
package_dir={'poezio': 'poezio',
|
package_dir={'poezio': 'poezio',
|
||||||
'poezio_plugins': 'plugins',
|
'poezio_plugins': 'plugins',
|
||||||
'poezio_themes': 'data/themes'},
|
'poezio_themes': 'data/themes'},
|
||||||
package_data={'poezio': ['default_config.cfg']},
|
package_data={'poezio': ['default_config.cfg']},
|
||||||
scripts=['scripts/poezio_gpg_export', 'scripts/poezio_logs'],
|
scripts=['scripts/poezio_logs'],
|
||||||
entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
|
entry_points={'console_scripts': ['poezio = poezio.__main__:run']},
|
||||||
data_files=([('share/man/man1/', ['data/poezio.1',
|
data_files=([('share/man/man1/', ['data/poezio.1',
|
||||||
'data/poezio_gpg_export.1',
|
|
||||||
'data/poezio_logs.1']),
|
'data/poezio_logs.1']),
|
||||||
('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG'])]
|
('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG'])]
|
||||||
+ find_doc('share/doc/poezio/source', 'source')
|
+ find_doc('share/doc/poezio/source', 'source')
|
||||||
|
|
Loading…
Reference in a new issue