diff options
-rw-r--r-- | data/poezio_gpg_export.1 | 60 | ||||
-rwxr-xr-x | scripts/poezio_gpg_export | 82 | ||||
-rwxr-xr-x | setup.py | 5 |
3 files changed, 2 insertions, 145 deletions
diff --git a/data/poezio_gpg_export.1 b/data/poezio_gpg_export.1 deleted file mode 100644 index 0d163440..00000000 --- a/data/poezio_gpg_export.1 +++ /dev/null @@ -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 diff --git a/scripts/poezio_gpg_export b/scripts/poezio_gpg_export deleted file mode 100755 index 5b18218f..00000000 --- a/scripts/poezio_gpg_export +++ /dev/null @@ -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() @@ -117,15 +117,14 @@ setup(name="poezio", 'Programming Language :: Python :: 3 :: Only'], keywords=['jabber', 'xmpp', 'client', 'chat', 'im', 'console'], packages=['poezio', 'poezio.core', 'poezio.tabs', 'poezio.windows', - 'poezio_plugins', 'poezio_plugins.gpg', 'poezio_themes'], + 'poezio_plugins', 'poezio_themes'], package_dir={'poezio': 'poezio', 'poezio_plugins': 'plugins', 'poezio_themes': 'data/themes'}, 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']}, data_files=([('share/man/man1/', ['data/poezio.1', - 'data/poezio_gpg_export.1', 'data/poezio_logs.1']), ('share/poezio/', ['README.rst', 'COPYING', 'CHANGELOG'])] + find_doc('share/doc/poezio/source', 'source') |