From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 78241138ACE for ; Thu, 1 Jan 2015 17:45:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EB1E6E08D5; Thu, 1 Jan 2015 17:44:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 34644E08D5 for ; Thu, 1 Jan 2015 17:44:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 429733406A4 for ; Thu, 1 Jan 2015 17:44:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 58334EA76 for ; Thu, 1 Jan 2015 17:44:54 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1420079992.198f91d769e9573f63cfcb3379c009957658f961.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-gen/gkeygen/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys-gen/gkeygen/actions.py X-VCS-Directories: gkeys-gen/gkeygen/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 198f91d769e9573f63cfcb3379c009957658f961 X-VCS-Branch: master Date: Thu, 1 Jan 2015 17:44:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 46554bcb-fa94-4390-bd88-04d889a7b650 X-Archives-Hash: 5e26039b062ad5e2e2604d149287fc03 commit: 198f91d769e9573f63cfcb3379c009957658f961 Author: Brian Dolbec gentoo org> AuthorDate: Wed Dec 31 06:40:26 2014 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Thu Jan 1 02:39:52 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=198f91d7 gkeygen/actions.py: Py 3 fixes Both downloads in py3 are byte strings. Need to decode them. Change the "No password given" messages. Add a logger.eror message with the GpgmeError received. --- gkeys-gen/gkeygen/actions.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gkeys-gen/gkeygen/actions.py b/gkeys-gen/gkeygen/actions.py index e329397..8ddf624 100644 --- a/gkeys-gen/gkeygen/actions.py +++ b/gkeys-gen/gkeygen/actions.py @@ -99,7 +99,7 @@ class Actions(object): shutil.copy('/usr/share/gnupg/gpg-conf.skel', newgpgconfpath) with open(newgpgconfpath, 'a') as conf: for line in urlopen(self.config.get_key('gpg-urls', args.spec)): - conf.write(_unicode(line)) + conf.write(_unicode(line.decode('utf-8'))) # Key generation ctx = gpgme.Context() self.logger.info("MAIN: _action_genkey: Generating GPG key...") @@ -109,9 +109,10 @@ class Actions(object): " This helps the random number generator work effectively"]) try: result = ctx.genkey(key_params) - except gpgme.GpgmeError: - self.logger.debug("MAIN: _action_genkey: Aborting... No given password.") - messages.extend(['', "Aborting... No given password."]) + except gpgme.GpgmeError as e: + self.logger.error("MAIN: _action_genkey: GpgmeError: %s" % str(e)) + self.logger.debug("MAIN: _action_genkey: Aborting... Failed to get a password.") + messages.extend(['', "Aborting... Failed to get a password."]) return (False, messages) key = ctx.get_key(result.fpr, True) self.logger.debug("MAIN: _action_genkey: Generated key: %s - %s" @@ -139,5 +140,5 @@ class Actions(object): print("\nReview:\n Full Name: %s\n Email: %s\n" % (name, email)) url = self.config.get_key('spec-urls', args.spec) key_properties = urlopen(url).read() - return _unicode(key_properties).format(name, email) + return _unicode(key_properties.decode('utf-8')).format(name, email)