gnu: Add python-pygpgme

* gnu/packages/gnupg.scm (python-pygpgme, python2-pygpgme): New variables.
* gnu/packages/patches/pygpgme-disable-problematic-tests.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
This commit is contained in:
Christopher Allan Webber 2016-02-05 11:06:54 -08:00
parent 08cb746f08
commit a05d1d82c0
3 changed files with 80 additions and 0 deletions

View file

@ -665,6 +665,7 @@ dist_patch_DATA = \
gnu/packages/patches/pycairo-wscript.patch \
gnu/packages/patches/pybugz-encode-error.patch \
gnu/packages/patches/pybugz-stty.patch \
gnu/packages/patches/pygpgme-disable-problematic-tests.patch \
gnu/packages/patches/pyqt-configure.patch \
gnu/packages/patches/python-2-deterministic-build-info.patch \
gnu/packages/patches/python-2.7-search-paths.patch \

View file

@ -5,6 +5,7 @@
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -23,6 +24,7 @@
(define-module (gnu packages gnupg)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages adns)
#:use-module (gnu packages curl)
#:use-module (gnu packages openldap)
@ -332,6 +334,46 @@ (define-public gpgme
and every application benefits from this.")
(license license:lgpl2.1+)))
(define-public python-pygpgme
(package
(name "python-pygpgme")
(version "0.3")
(source
(origin
(method url-fetch)
(uri (pypi-uri "pygpgme" version))
(sha256
(base32
"1q82p3gs6lwq8j8dxk4pvrwk3jpww1zqcjrzznl9clh10z28gn2z"))
;; Unfortunately, we have to disable some tests due to some gpg-agent
;; goofiness... see:
;; https://bugs.launchpad.net/pygpgme/+bug/999949
(patches (list (search-patch "pygpgme-disable-problematic-tests.patch")))))
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'build 'make-build
(lambda _
(zero? (system* "make" "build"))))
(replace 'check
(lambda _
(zero? (system* "make" "check")))))))
(build-system python-build-system)
(inputs
`(;; setuptools required for python-2 variant
("python-setuptools" ,python-setuptools)
("gnupg" ,gnupg-2.0)
("gpgme" ,gpgme)))
(home-page "https://launchpad.net/pygpgme")
(synopsis "Python module for working with OpenPGP messages")
(description
"PyGPGME is a Python module that lets you sign, verify, encrypt and
decrypt messages using the OpenPGP format by making use of GPGME.")
(license license:lgpl2.1+)))
(define-public python2-pygpgme
(package-with-python2 python-pygpgme))
(define-public python-gnupg
(package
(name "python-gnupg")

View file

@ -0,0 +1,37 @@
These tests require a gpg agent to run, and are difficult to get to work right
in Guix's environment. For more details, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713074
https://bugs.launchpad.net/pygpgme/+bug/999949
--- pygpgme-0.3/tests/test_encrypt_decrypt.py 2012-02-28 19:10:28.000000000 -0800
+++ pygpgme-0.3/tests/test_encrypt_decrypt.py 2016-02-05 10:21:58.966685384 -0800
@@ -125,7 +125,7 @@
ctx.decrypt(ciphertext, plaintext)
self.assertEqual(plaintext.getvalue(), b'Hello World\n')
- def test_encrypt_symmetric(self):
+ def skip_test_encrypt_symmetric(self):
plaintext = BytesIO(b'Hello World\n')
ciphertext = BytesIO()
def passphrase(uid_hint, passphrase_info, prev_was_bad, fd):
--- pygpgme-0.3/tests/test_passphrase.py 2012-02-28 19:04:17.000000000 -0800
+++ pygpgme-0.3/tests/test_passphrase.py 2016-02-05 10:21:47.990630956 -0800
@@ -30,7 +30,7 @@
import_keys = ['passphrase.pub', 'passphrase.sec']
- def test_sign_without_passphrase_cb(self):
+ def skip_test_sign_without_passphrase_cb(self):
ctx = gpgme.Context()
key = ctx.get_key('EFB052B4230BBBC51914BCBB54DCBBC8DBFB9EB3')
ctx.signers = [key]
@@ -51,7 +51,7 @@
self.prev_was_bad = prev_was_bad
os.write(fd, b'test\n')
- def test_sign_with_passphrase_cb(self):
+ def skip_test_sign_with_passphrase_cb(self):
ctx = gpgme.Context()
key = ctx.get_key('EFB052B4230BBBC51914BCBB54DCBBC8DBFB9EB3')
ctx.signers = [key]