From d43d3e66b5582c1e5b8e61eaf7f3ac8866c997a4 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 17 May 2016 17:46:31 +0900 Subject: [PATCH] Adjust to epg-configuration deprecation. * test/lisp/epg-tests.el (epg-tests-gpg-usable): Use `epg-find-configuration' instead of deprecated `epg-configuration'. --- test/lisp/epg-tests.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el index 4a31797..06e6f25 100644 --- a/test/lisp/epg-tests.el +++ b/test/lisp/epg-tests.el @@ -30,16 +30,20 @@ epg-tests-data-directory (expand-file-name "data/epg" (getenv "EMACS_TEST_DIRECTORY")) "Directory containing epg test data.") +;; If a passphrase is required, we can only use GnuPG 1.x, as GnuPG +;; 2.0 or later involves gpg-agent, which prevents injecting +;; passphrase reliably. (defun epg-tests-gpg-usable (&optional require-passphrase) - (and (executable-find epg-gpg-program) - (condition-case nil - (progn - (epg-check-configuration (epg-configuration)) - (if require-passphrase - (string-match "\\`1\\." - (cdr (assq 'version (epg-configuration)))) - t)) - (error nil)))) + (let ((config (epg-find-configuration 'OpenPGP))) + (and config + (condition-case nil + (progn + (epg-check-configuration config) + (if require-passphrase + (string-match "\\`1\\." + (cdr (assq 'version config))) + t)) + (error nil))))) (defun epg-tests-passphrase-callback (_c _k _d) ;; Need to create a copy here, since the string will be wiped out -- 2.5.5