Attached the patch for updating the keepassx2pass to python3, in agreement to other parsers. Any chance this gets merged?
Thanks Fabio On 12/23/2016 02:58 AM, Fabio Zanini wrote: > Dear all, > > This is my first message to the list, so please excuse any wrong > etiquette. I have updated the importer from keepassx to python3, which > is used in several other importers and is becoming the standard python > version (see e.g. Guido Van Rossum's announcement, PEP 373: > https://www.python.org/dev/peps/pep-0373/). > > I made a git patch, would you like me to just post it here or what is > the usual way of reviewing such contributions? I'm used to github and > pull requests... > > Cheers, > Fabio > > > > _______________________________________________ > Password-Store mailing list > [email protected] > https://lists.zx2c4.com/mailman/listinfo/password-store >
From 01d98b8d5ceac2ef2f888829e704f3ba880e9edb Mon Sep 17 00:00:00 2001 From: Fabio Zanini <[email protected]> Date: Fri, 23 Dec 2016 02:47:26 -0800 Subject: [PATCH] keepassx2pass.py importer to python3 --- contrib/importers/keepassx2pass.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/importers/keepassx2pass.py b/contrib/importers/keepassx2pass.py index 54d9fbc..2d052a6 100755 --- a/contrib/importers/keepassx2pass.py +++ b/contrib/importers/keepassx2pass.py @@ -1,8 +1,10 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # # Copyright (C) 2012 Juhamatti Niemelä <[email protected]>. All Rights Reserved. # This file is licensed under the GPLv2+. Please see COPYING for more information. +# Edited 2016 by Fabio Zanini. +# +# Usage ./keepassx2pass.py export.xml import sys import re @@ -44,10 +46,10 @@ def password_data(element): """ Return password data and additional info if available from password entry element. """ passwd = element.find('password').text - ret = passwd + "\n" if passwd else "\n" + ret = (passwd + "\n") if passwd else "\n" for field in ['username', 'url', 'comment']: fel = element.find(field) - children = [unicode(e.text or '') + unicode(e.tail or '') for e in list(fel)] + children = [(e.text or '') + (e.tail or '') for e in list(fel)] if len(children) > 0: children.insert(0, '') text = (fel.text or '') + "\n".join(children) @@ -58,11 +60,11 @@ def password_data(element): def import_entry(element, path=''): """ Import new password entry to password-store using pass insert command """ - print "Importing " + path_for(element, path) + print("Importing " + path_for(element, path)) proc = Popen(['pass', 'insert', '--multiline', '--force', path_for(element, path)], - stdin=PIPE, stdout=PIPE) - proc.communicate(password_data(element).encode('utf8')) + stdin=PIPE, stdout=PIPE) + proc.communicate(password_data(element).encode()) proc.wait() def import_group(element, path=''): -- 2.11.0
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Password-Store mailing list [email protected] https://lists.zx2c4.com/mailman/listinfo/password-store
