[Pkg-gnupg-commit] [gpgme] 67/132: python: Add convenience functions for the home directory.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 26 01:01:26 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gpgme.
commit 99b7f4f34dd595579181a696ae976a678fe00d49
Author: Justus Winter <justus at g10code.com>
Date: Tue Feb 14 13:43:01 2017 +0100
python: Add convenience functions for the home directory.
* NEWS: Update.
* lang/python/gpg/core.py (Context.__init__): Add 'home_dir' argument.
(__repr__): Include 'home_dir'.
(Context.home_dir): New property.
Signed-off-by: Justus Winter <justus at g10code.com>
---
NEWS | 2 ++
lang/python/gpg/core.py | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 4405f6c..7ec3dfb 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Noteworthy changes in version 1.8.1 (unreleased)
cpp: Key::addUid() NEW.
qt: CryptoConfig::stringValueList() NEW.
gpgme_data_rewind UN-DEPRECATE.
+ py: Context.__init__ EXTENDED: New keyword argument home_dir.
+ py: Context.home_dir NEW.
Noteworthy changes in version 1.8.0 (2016-11-16)
diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index 43856ab..79d1f53 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -176,7 +176,7 @@ class Context(GpgmeWrapper):
def __init__(self, armor=False, textmode=False, offline=False,
signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT,
protocol=constants.PROTOCOL_OpenPGP,
- wrapped=None):
+ wrapped=None, home_dir=None):
"""Construct a context object
Keyword arguments:
@@ -186,6 +186,7 @@ class Context(GpgmeWrapper):
signers -- list of keys used for signing (default [])
pinentry_mode -- pinentry mode (default PINENTRY_MODE_DEFAULT)
protocol -- protocol to use (default PROTOCOL_OpenPGP)
+ home_dir -- state directory (default is the engine default)
"""
if wrapped:
@@ -203,13 +204,14 @@ class Context(GpgmeWrapper):
self.signers = signers
self.pinentry_mode = pinentry_mode
self.protocol = protocol
+ self.home_dir = home_dir
def __repr__(self):
return (
"Context(armor={0.armor}, "
"textmode={0.textmode}, offline={0.offline}, "
"signers={0.signers}, pinentry_mode={0.pinentry_mode}, "
- "protocol={0.protocol}"
+ "protocol={0.protocol}, home_dir={0.home_dir}"
")").format(self)
def encrypt(self, plaintext, recipients=[], sign=True, sink=None,
@@ -610,6 +612,14 @@ class Context(GpgmeWrapper):
errorcheck(gpgme.gpgme_engine_check_version(value))
self.set_protocol(value)
+ @property
+ def home_dir(self):
+ """Engine's home directory"""
+ return self.engine_info.home_dir
+ @home_dir.setter
+ def home_dir(self, value):
+ self.set_engine_info(self.protocol, home_dir=value)
+
_ctype = 'gpgme_ctx_t'
_cprefix = 'gpgme_'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git
More information about the Pkg-gnupg-commit
mailing list