unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 01/04] gnu: Add python-pygpgme
@ 2016-02-06  3:47 Christopher Allan Webber
  2016-02-06  8:29 ` Leo Famulari
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Allan Webber @ 2016-02-06  3:47 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 50 bytes --]

First of several patches on the path to assword!


[-- Attachment #2: 0001-gnu-Add-python-pygpgme.patch --]
[-- Type: text/x-patch, Size: 4979 bytes --]

From 2137270785d39d2592e4ffc2b3c3253fd0daf540 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <cwebber@dustycloud.org>
Date: Fri, 5 Feb 2016 11:06:54 -0800
Subject: [PATCH 1/4] 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/packages/gnupg.scm                             | 42 ++++++++++++++++++++++
 .../pygpgme-disable-problematic-tests.patch        | 37 +++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 gnu/packages/patches/pygpgme-disable-problematic-tests.patch

diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 501cf55..bdc5e4a 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -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 @@ instead.  This way bug fixes or improvements can be done at a central place
 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 (. args)
+               (zero? (system* "make" "build"))))
+         (replace 'check
+           (lambda _
+             (zero? (system* "make" "check")))))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-setuptools" ,python-setuptools)
+       ("gnupg" ,gnupg-2.0)
+       ("gpgme" ,gpgme)))
+    (home-page "https://launchpad.net/pygpgme")
+    (synopsis
+     "A 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.")
+    (license license:lgpl2.1+)))
+
+(define-public python2-pygpgme
+  (package-with-python2 python-pygpgme))
+
 (define-public python-gnupg
   (package
     (name "python-gnupg")
diff --git a/gnu/packages/patches/pygpgme-disable-problematic-tests.patch b/gnu/packages/patches/pygpgme-disable-problematic-tests.patch
new file mode 100644
index 0000000..2129d2f
--- /dev/null
+++ b/gnu/packages/patches/pygpgme-disable-problematic-tests.patch
@@ -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]
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 01/04] gnu: Add python-pygpgme
  2016-02-06  3:47 [PATCH 01/04] gnu: Add python-pygpgme Christopher Allan Webber
@ 2016-02-06  8:29 ` Leo Famulari
  2016-02-06 12:55   ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Leo Famulari @ 2016-02-06  8:29 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel

On Fri, Feb 05, 2016 at 07:47:26PM -0800, Christopher Allan Webber wrote:
> First of several patches on the path to assword!

Thanks! Funniest package name in Guix, I'd say!

> * gnu/packages/gnupg.scm (python-pygpgme, python2-pygpgme): New variables.
> * gnu/packages/patches/pygpgme-disable-problematic-tests.patch: New file.

Please add the patch to gnu-system.am (dist_patch_DATA).

> ---
>  gnu/packages/gnupg.scm                             | 42 ++++++++++++++++++++++
>  .../pygpgme-disable-problematic-tests.patch        | 37 +++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100644 gnu/packages/patches/pygpgme-disable-problematic-tests.patch
> 
> diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
> index 501cf55..bdc5e4a 100644
> --- a/gnu/packages/gnupg.scm
> +++ b/gnu/packages/gnupg.scm
> @@ -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 @@ instead.  This way bug fixes or improvements can be done at a central place
>  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 (. args)
> +               (zero? (system* "make" "build"))))

I'm not a Scheme expert, but I wonder about "lambda (.args)". Most of
these calls to (system*) start with "lambda _". What is the difference
here?

> +         (replace 'check
> +           (lambda _
> +             (zero? (system* "make" "check")))))))
> +    (build-system python-build-system)
> +    (inputs
> +     `(("python-setuptools" ,python-setuptools)

If setuptools are only required for the python-2 variant, please add a
comment to that effect, so that we can easily remove it once we fix bug
#22437.
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22437

> +       ("gnupg" ,gnupg-2.0)

Does it only work with gnupg-2.0? We also package the 2.1 series of
GnuPG.

> +       ("gpgme" ,gpgme)))
> +    (home-page "https://launchpad.net/pygpgme")
> +    (synopsis
> +     "A Python module for working with OpenPGP messages")

This can all go on one line.

> +    (description
> +     "PyGPGME is a Python module that lets you sign, verify, encrypt and
> +decrypt messages using the OpenPGP format.")

Can you mention that it uses GPGME in the description?

> +    (license license:lgpl2.1+)))
> +
> +(define-public python2-pygpgme
> +  (package-with-python2 python-pygpgme))
> +
>  (define-public python-gnupg
>    (package
>      (name "python-gnupg")
> diff --git a/gnu/packages/patches/pygpgme-disable-problematic-tests.patch b/gnu/packages/patches/pygpgme-disable-problematic-tests.patch
> new file mode 100644
> index 0000000..2129d2f
> --- /dev/null
> +++ b/gnu/packages/patches/pygpgme-disable-problematic-tests.patch
> @@ -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]
> -- 
> 2.6.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 01/04] gnu: Add python-pygpgme
  2016-02-06  8:29 ` Leo Famulari
@ 2016-02-06 12:55   ` Ludovic Courtès
  2016-02-06 19:33     ` Christopher Allan Webber
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:55 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Leo Famulari <leo@famulari.name> skribis:

> On Fri, Feb 05, 2016 at 07:47:26PM -0800, Christopher Allan Webber wrote:

[...]

>> +       ;; 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 (. args)
>> +               (zero? (system* "make" "build"))))
>
> I'm not a Scheme expert, but I wonder about "lambda (.args)". Most of
> these calls to (system*) start with "lambda _". What is the difference
> here?

(lambda (. args) …) is equivalent to (lambda args …), meaning a
procedure that takes an unlimited number of arguments.

It’s a convention to use ‘_’ to denote unused variables, so we usually
write (lambda _ …) in such cases.

The lambda above is slightly two indented; perhaps the guix-devel Emacs
mode isn’t loaded?

>> +       ("gnupg" ,gnupg-2.0)
>
> Does it only work with gnupg-2.0? We also package the 2.1 series of
> GnuPG.

I think we should stick to 2.0, which is the latest stable version.

>> +       ("gpgme" ,gpgme)))
>> +    (home-page "https://launchpad.net/pygpgme")
>> +    (synopsis
>> +     "A Python module for working with OpenPGP messages")
>
> This can all go on one line.

Also please remove “A” (I think ‘guix lint’ would complain.)

OK to push with these and Leo’s other comments addressed!

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 01/04] gnu: Add python-pygpgme
  2016-02-06 12:55   ` Ludovic Courtès
@ 2016-02-06 19:33     ` Christopher Allan Webber
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Allan Webber @ 2016-02-06 19:33 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès writes:

> OK to push with these and Leo’s other comments addressed!
>
> Thank you,
> Ludo’.

Changes made, and pushed, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-06 19:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-06  3:47 [PATCH 01/04] gnu: Add python-pygpgme Christopher Allan Webber
2016-02-06  8:29 ` Leo Famulari
2016-02-06 12:55   ` Ludovic Courtès
2016-02-06 19:33     ` Christopher Allan Webber

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).