unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add python2-gnomekeyring.
@ 2015-04-19 18:05 Ricardo Wurmus
  2015-04-21 15:59 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Wurmus @ 2015-04-19 18:05 UTC (permalink / raw)
  To: Guix-devel

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

Hi Guix,

the first patch defines a function to create packages from
python2-gnome-desktop components and redefines python2-rsvg using this
function.

The second patch adds python2-gnomekeyring using the very same generator
function.

~~ Ricardo


[-- Attachment #2: 0001-gnu-python2-rsvg-Define-with-helper-function.patch --]
[-- Type: text/x-patch, Size: 3614 bytes --]

From 9045e6d296593a7f81269ecfab327733853b68f4 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Thu, 5 Mar 2015 08:38:13 +0100
Subject: [PATCH 1/2] gnu: python2-rsvg: Define with helper function.

* gnu/packages/gnome.scm (python2-gnome-desktop-component): New variable.
---
 gnu/packages/gnome.scm | 56 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 41 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 33ce2e8..c303826 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2014, 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
+;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1611,36 +1612,61 @@ commercial X servers. It is useful for creating XKB-related software (layout
 indicators etc).")
     (license license:lgpl2.0+)))
 
-(define-public python2-rsvg
-  ;; XXX: This is actually a subset of gnome-python-desktop.
+(define (python2-gnome-desktop-component comp syn desc ins lic)
   (package
-    (name "python2-rsvg")
+    (name (string-append "python2-" comp))
     (version "2.32.0")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
-             "mirror://gnome/sources/gnome-python-desktop/2.32/gnome-python-desktop-"
+             "mirror://gnome/sources/gnome-python-desktop/"
+             (version-major+minor version) "/gnome-python-desktop-"
              version ".tar.bz2"))
        (sha256
         (base32
          "1s8f9rns9v7qlwjv9qh9lr8crp88dpzfm45hj47zc3ivpy0dbnq9"))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+        (alist-cons-before
+         'build 'enter-dir
+         (lambda _ (chdir ,comp))
+         (alist-cons-after
+          'install 'install-pth
+          (lambda* (#:key outputs #:allow-other-keys)
+            ;; The modules are stored in a subdirectory of python's
+            ;; site-packages directory.  Add a .pth file so that python will
+            ;; add that subdirectory to its module search path.
+            (call-with-output-file
+                (string-append
+                 (assoc-ref outputs "out")
+                 "/lib/python"
+                 ,(version-major+minor
+                   (package-version python-2))
+                 "/site-packages" "/" ,comp ".pth")
+                (lambda (port)
+                  (format port "gtk-2.0~%")))
+            #t)
+          %standard-phases))))
+    (inputs
+     `(("python2" ,python-2)
+       ("pygtk" ,python2-pygtk)
+       ,@ins))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
-    (inputs
-     `(("python" ,python-2)
-       ("python2-pygtk" ,python2-pygtk)
-       ("librsvg" ,librsvg)))
     (home-page "http://www.gnome.org")
-    (synopsis "Python bindings to librsvg")
-    (description
-     "This packages provides Python bindings to librsvg, the SVG rendering
-library.")
+    (synopsis syn)
+    (description desc)
+    (license lic)))
 
-    ;; This is the license of the rsvg bindings.  The license of each module
-    ;; of gnome-python-desktop is given in 'COPYING'.
-    (license license:lgpl2.1+)))
+(define-public python2-rsvg
+  (python2-gnome-desktop-component
+   "rsvg"
+   "Python bindings to librsvg"
+   "This module contains bindings allowing the use of librsvg in Python."
+   `(("librsvg" ,librsvg))
+   license:lgpl2.1+))
 
 (define-public glib-networking
   (package
-- 
2.1.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-python2-gnomekeyring.patch --]
[-- Type: text/x-patch, Size: 963 bytes --]

From ba6cbc73f4ff3f1f5fc8e4ca26e867dc85291bd1 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sun, 19 Apr 2015 18:59:01 +0200
Subject: [PATCH 2/2] gnu: Add python2-gnomekeyring.

* gnu/packages/gnome.scm (python2-gnomekeyring): New variable.
---
 gnu/packages/gnome.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index c303826..14d2520 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -1668,6 +1668,15 @@ indicators etc).")
    `(("librsvg" ,librsvg))
    license:lgpl2.1+))
 
+(define-public python2-gnomekeyring
+  (python2-gnome-desktop-component
+   "gnomekeyring"
+   "Python bindings to libgnome-keyring"
+   "This module contains bindings allowing the use of the GNOME keyring in
+Python."
+   `(("libgnome-keyring" ,libgnome-keyring))
+   license:lgpl2.1+))
+
 (define-public glib-networking
   (package
     (name "glib-networking")
-- 
2.1.0


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

* Re: [PATCH] gnu: Add python2-gnomekeyring.
  2015-04-19 18:05 [PATCH] gnu: Add python2-gnomekeyring Ricardo Wurmus
@ 2015-04-21 15:59 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-04-21 15:59 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix-devel

Ricardo Wurmus <rekado@elephly.net> skribis:

> the first patch defines a function to create packages from
> python2-gnome-desktop components and redefines python2-rsvg using this
> function.

Would it make sense to just have python2-gnome-desktop containing
everything, or would that be overkill?  (I suspect the latter, but I
want to make sure.)

> From 9045e6d296593a7f81269ecfab327733853b68f4 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Thu, 5 Mar 2015 08:38:13 +0100
> Subject: [PATCH 1/2] gnu: python2-rsvg: Define with helper function.
>
> * gnu/packages/gnome.scm (python2-gnome-desktop-component): New variable.

[...]

> +(define (python2-gnome-desktop-component comp syn desc ins lic)

Please spell out the argument names and add a docstring.

> +    (synopsis syn)
> +    (description desc)
> +    (license lic)))


[...]

> +(define-public python2-rsvg
> +  (python2-gnome-desktop-component
> +   "rsvg"
> +   "Python bindings to librsvg"
> +   "This module contains bindings allowing the use of librsvg in Python."

The problem is that xgettext won’t notice these.

A little bit of extra syntax is needed to placate it so that you can
write:

  (define-public python2-rsvg
    (python2-gnome-desktop-component
      "rsvg"
      (synopsis "Python bindings to librsvg")
      (description "This module contains bindings allowing the use of
librsvg in Python.")))

So let’s say:

  (define-syntax python2-gnome-desktop-component
    (syntax-rules (synopsis description)
      ((_ component (synopsis synopsis*) (description description*))
       (%python2-gnome-desktop-component component synopsis*
                                         description*))))

Where ‘%python2-gnome-desktop-component’ is the new name of the
procedure that this patch calls ‘python2-gnome-desktop-component’.

Really a hack, but hey, such is life.  ;-)

> From ba6cbc73f4ff3f1f5fc8e4ca26e867dc85291bd1 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Sun, 19 Apr 2015 18:59:01 +0200
> Subject: [PATCH 2/2] gnu: Add python2-gnomekeyring.
>
> * gnu/packages/gnome.scm (python2-gnomekeyring): New variable.

OK.

Thanks,
Ludo’.

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

end of thread, other threads:[~2015-04-21 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-19 18:05 [PATCH] gnu: Add python2-gnomekeyring Ricardo Wurmus
2015-04-21 15:59 ` Ludovic Courtès

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).