[PATCH] gnu: Add xdotool.

2014-12-14 Thread John Darrington
* gnu/packages/xdisorg.scm (xdotool): New variable.
---
 gnu/packages/xdisorg.scm |   42 ++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 6820d01..1c29330 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -29,6 +29,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages xorg))
 
 ;; packages outside the x.org system proper
@@ -57,6 +58,47 @@ can also be used for copying files, as an alternative to 
sftp/scp, thus
 avoiding password prompts when X11 forwarding has already been setup.")
 (license license:gpl2+)))
 
+(define-public xdotool
+  (package
+(name "xdotool")
+(version "2.20110530.1")
+(source
+  (origin
+(method url-fetch)
+(uri (string-append
+  "http://semicomplete.googlecode.com/files/"; name "-"
+  version ".tar.gz"))
+(sha256
+  (base32
+   "0rxggg1cy7nnkwidx8x2w3c5f3pk6dh2b6q0q7hp069r3n5jrd77"
+(build-system gnu-build-system)
+(arguments
+ '(#:tests? #f ; Test suite requires a lot of black magic
+   #:phases 
+   (alist-replace 'configure 
+  (lambda* (#:key outputs #:allow-other-keys #:rest args)
+(setenv "PREFIX" (assoc-ref outputs "out"))
+(setenv "LDFLAGS"  (string-append "-Wl,-rpath="
+(assoc-ref %outputs 
"out") "/lib"))
+
+(setenv "CC" "gcc"))
+  %standard-phases)))
+(native-inputs `(("perl" ,perl))) ; for pod2man
+(inputs `(("libx11" ,libx11)
+  ("libxext" ,libxext)
+  ("libxi" ,libxi)
+  ("libxinerama" ,libxinerama)
+  ("libxtst" ,libxtst)))
+(home-page "http://www.semicomplete.com/projects/xdotool";)
+(synopsis "Fake keyboard/mouse input, window management, and more")
+(description "Xdotool lets you simulate keyboard input and mouse activity,
+move and resize windows, etc. It does this using X11's XTEST extension and
+other Xlib functions.  Additionally, you can search for windows and move,
+resize, hide, and modify window properties like the title. If your window
+manager supports it, you can use xdotool to switch desktops, move windows
+between desktops, and change the number of desktops.")
+(license license:bsd-3)))
+
 (define-public xeyes
   (package
 (name "xeyes")
-- 
1.7.10.4




Re: [PATCH 1/2] gnu: Add vte.

2014-12-14 Thread David Thompson
宋文武  writes:

> * gnu/packages/gnome.scm (vte, vte-0): New variables.
> ---
>  gnu/packages/gnome.scm | 57 
> +-
>  1 file changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 5d84f4e..7087727 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -47,7 +47,8 @@
>#:use-module (gnu packages gl)
>#:use-module (gnu packages compression)
>#:use-module (gnu packages xorg)
> -  #:use-module (gnu packages xdisorg))
> +  #:use-module (gnu packages xdisorg)
> +  #:use-module (gnu packages ncurses))
>  
>  (define-public brasero
>(package
> @@ -1324,3 +1325,57 @@ language features to GNOME developers without imposing 
> any additional runtime
>  requirements and without using a different ABI compared to applications and
>  libraries written in C.")
>  (license license:lgpl2.1+)))
> +
> +(define-public vte
> +  (package
> +(name "vte")
> +(version "0.38.2")
> +(source (origin
> +  (method url-fetch)
> +  (uri (string-append "mirror://gnome/sources/" name "/"
> +  (version-major+minor version) "/"
> +  name "-" version ".tar.xz"))
> +  (sha256
> +   (base32
> +"1rbxrigff9yszbgdw0gw4c2saz4d1hbbpz21phzxx14w49wvmnmj"
> +(build-system gnu-build-system)
> +(native-inputs
> + `(("pkg-config" ,pkg-config)
> +   ("intltool" ,intltool)
> +   ("vala" ,vala)
> +   ("gobject-introspection" ,gobject-introspection)
> +   ("glib" ,glib "bin") ; for glib-genmarshal, etc.
> +   ("xmllint" ,libxml2)))
> +(propagated-inputs
> + `(("gtk+" ,gtk+))) ; required by libvte-2.91.pc
> +(home-page "http://www.gnome.org/";)
> +(synopsis "Virtual Terminal Emulator")
> +(description
> + "VTE is a library (libvte) implementing a terminal emulator widget for
> +GTK+, and a minimal sample application (vte) using that.  Vte is mainly used 
> in
> +gnome-terminal, but can also be used to embed a console/terminal in games,
> +editors, IDEs, etc.")
> +(license license:lgpl2.1+)))
> +
> +;; stable version for gtk2, required by xfce4-terminal.
> +(define-public vte-0

Maybe call this one 'vte-gtk2'?  'vte-0' isn't very descriptive.

> +  (package (inherit vte)
> +(name "vte")
> +(version "0.28.2")
> +(source (origin
> +  (method url-fetch)
> +  (uri (string-append "mirror://gnome/sources/" name "/"
> +  (version-major+minor version) "/"
> +  name "-" version ".tar.xz"))
> +  (sha256
> +   (base32
> +"1bmhahkf8wdsra9whd3k5l5z4rv7r58ksr8mshzajgq2ma0hpkw6"
> +(arguments
> + '(#:configure-flags '("--disable-python")))
> +(native-inputs
> + `(("pkg-config" ,pkg-config)
> +   ("intltool" ,intltool)
> +   ("glib" ,glib "bin")))   ; for glib-genmarshal, etc.
> +(propagated-inputs
> + `(("gtk+" ,gtk+-2) ; required by libvte.pc
> +   ("ncurses" ,ncurses) ; required by libvte.la
> -- 
> 2.1.2
>
>

Looks good otherwise!

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate



Re: [PATCH] gnu: Add xdotool.

2014-12-14 Thread Alex Kost
I've tried this patch and it has been built successfully on my i686 machine.

So only nitpickings from me.

John Darrington (2014-12-14 13:48 +0300) wrote:

[...]
> +(arguments
> + '(#:tests? #f ; Test suite requires a lot of black magic
> +   #:phases 
Trailing space↑
> +   (alist-replace 'configure 
Another one↑
> +  (lambda* (#:key outputs #:allow-other-keys #:rest args)
> +(setenv "PREFIX" (assoc-ref outputs "out"))
> +(setenv "LDFLAGS"  (string-append "-Wl,-rpath="
Double space↑↑
> +(assoc-ref %outputs 
> "out") "/lib"))
Not aligned properly and this line is too long ↑
> +
> +(setenv "CC" "gcc"))
> +  %standard-phases)))
> +(native-inputs `(("perl" ,perl))) ; for pod2man
> +(inputs `(("libx11" ,libx11)
> +  ("libxext" ,libxext)
> +  ("libxi" ,libxi)
> +  ("libxinerama" ,libxinerama)
> +  ("libxtst" ,libxtst)))
> +(home-page "http://www.semicomplete.com/projects/xdotool";)
> +(synopsis "Fake keyboard/mouse input, window management, and more")
> +(description "Xdotool lets you simulate keyboard input and mouse 
> activity,
> +move and resize windows, etc. It does this using X11's XTEST extension and
Single space↑
> +other Xlib functions.  Additionally, you can search for windows and move,
> +resize, hide, and modify window properties like the title. If your window
Single space ↑
> +manager supports it, you can use xdotool to switch desktops, move windows
> +between desktops, and change the number of desktops.")
> +(license license:bsd-3)))

IIUC using double spaces in the end of sentences is a convention.  Also
I noticed that you make descriptions look like this:

  (description "…")

This makes the first line significantly shorter than other ones, so some
people (including me) prefer the following variant:

  (description
   "…")

What about making a convention on how "description" fields should look.
Ludo?

-- 
Alex



Configuration & better defaults for nscd

2014-12-14 Thread Ludovic Courtès
Commit 6454b33 makes nscd’s policy configuration, and uses better
defaults where host and service lookups are aggressively cached (I felt
ashamed when I realized that running “nscd -f /dev/null” as we did
resulted in a default configuration with absolutely no caching.)

I looked at the nscd.conf file found in the glibc source to get an idea
of all this.  It seemed to be the only documentation, but now we also
have “bindings” for that file that are documented in the Guix manual.
:-)  (Attached below.)

Comments welcome!

Ludo’.


 -- Monadic Procedure: nscd-service [CONFIG] [#:glibc glibc]
 Return a service that runs libc’s name service cache daemon (nscd)
 with the given CONFIG—an ‘’ object.

 -- Scheme Variable: %nscd-default-configuration
 This is the default ‘’ value (see below) used
 by ‘nscd-service’.  This uses the caches defined by
 %NSCD-DEFAULT-CACHES; see below.

 -- Data Type: nscd-configuration
 This is the type representing the name service cache daemon (nscd)
 configuration.

 ‘log-file’ (default: ‘"/var/log/nscd.log"’)
  Name of nscd’s log file.  This is where debugging output goes
  when ‘debug-level’ is strictly positive.

 ‘debug-level’ (default: ‘0’)
  Integer denoting the debugging levels.  Higher numbers mean
  more debugging output is logged.

 ‘caches’ (default: %NSCD-DEFAULT-CACHES)
  List of ‘’ objects denoting things to be cached;
  see below.

 -- Data Type: nscd-cache
 Data type representing a cache database of nscd and its parameters.

 ‘database’
  This is a symbol representing the name of the database to be
  cached.  Valid values are ‘passwd’, ‘group’, ‘hosts’, and
  ‘services’, which designate the corresponding NSS database
  (*note (libc)NSS Basics::).

 ‘positive-time-to-live’
 ‘negative-time-to-live’ (default: ‘20’)
  A number representing the number of seconds during which a
  positive or negative lookup result remains in cache.

 ‘check-files?’ (default: ‘#t’)
  Whether to check for updates of the files corresponding to
  DATABASE.

  For instance, when DATABASE is ‘hosts’, setting this flag
  instructs nscd to check for updates in ‘/etc/hosts’ and to
  take them into account.

 ‘persistent?’ (default: ‘#t’)
  Whether the cache should be stored persistently on disk.

 ‘shared?’ (default: ‘#t’)
  Whether the cache should be shared among users.

 ‘max-database-size’ (default: 32 MiB)
  Maximum size in bytes of the database cache.

 -- Scheme Variable: %nscd-default-caches
 List of ‘’ objects used by default by
 ‘nscd-configuration’ (see above.)

 It enables persistent and aggressive caching of service and host
 name lookups.  The latter provides better host name lookup
 performance, resilience in the face of unreliable name servers, and
 also better privacy—often the result of host name lookups is in
 local cache, so external name servers do not even need to be
 queried.




Re: [PATCH] gnu: Add vala.

2014-12-14 Thread Ludovic Courtès
宋文武  skribis:

> * gnu/packages/gnome.scm (vala): New variable.

LGTM, thanks!

Ludo’.



Re: [PATCH] gnu: Add xdotool.

2014-12-14 Thread Ludovic Courtès
Alex Kost  skribis:

> IIUC using double spaces in the end of sentences is a convention. 

Indeed.  ‘guix lint’ should catch it.

> Also I noticed that you make descriptions look like this:
>
>   (description "…")
>
> This makes the first line significantly shorter than other ones, so some
> people (including me) prefer the following variant:
>
>   (description
>"…")
>
> What about making a convention on how "description" fields should look.
> Ludo?

I prefer the latter as well, but I don’t usually insist on that.

We don’t have specific written conventions; there’s .dir-locals.el, and
then a reference to a more general coding convention for Scheme in
‘HACKING’.  Would it help to have them written down?

Ludo’.



Re: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other packages

2014-12-14 Thread Ludovic Courtès
Mark H Weaver  skribis:

> In the past, xfce4-panel had a way to configure paths for per-user
> plugin directories, but later this was changed to use only compile-time
> constant paths, for reasons described here:
>
>   https://bugzilla.xfce.org/show_bug.cgi?id=5455
>
> Nix's current solution is simply to change the compile-time constant
> paths to /run/current-system/sw/..., which I found unsatisfying.

Agreed.  Users should be able to choose which plug-ins they wanna use.

> The following patch modifies xfce4-panel to search for panel plugins in
> directories specified by the XDG_DATA_DIRS and X_XFCE4_LIB_DIRS
> environment variables.  That latter name is my own invention, and I've
> waffled a bit on what to call it and how much of the pathname prefixes
> it should contain.

That sounds like the right approach to me.  I’d have called it just
‘XFCE4_LIB_DIRS’, but I guess you already discarded that for a good
reason, so that’s fine.  :-)

> From ffc34f08feb9175c140e7ee7d9dcfef07b0cb751 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver 
> Date: Sat, 13 Dec 2014 20:50:00 -0500
> Subject: [PATCH 1/2] gnu: xfce4-panel: Support panel plugins from other
>  packages.
>
> * gnu/packages/patches/xfce4-panel-plugins.patch: New file.
> * gnu-system.am (dist_patch_DATA): Add it.
> * gnu/packages/xfce.scm (xfce4-panel): Add the patch, and a
>   native search path specification for X_XFCE4_LIB_DIRS.

[...]

> +;; XXX This probably belongs somewhere else.
> +(native-search-paths
> + (list (search-path-specification
> +(variable "X_XFCE4_LIB_DIRS")
> +(directories '("lib/xfce4")

It those plug-ins are dlopened by xfce-panel, then this is the right
place, no?

LGTM!

Thank you,
Ludo’.



Installing guix

2014-12-14 Thread Amirouche Boubekki
Hello,


I installed GNU Guix distribution on my other machine to use it more
often. This will be a bit a long explanation.

My machine is kind of recent, and previously with other distro I had
all sort of trouble with uefi. Not this time, I don't know what is the
configuration of guix, I've just setup my bios to avoid uefi.

Here is what I've done:

The 0.8 release has not wpa_supplicant and I didn't want to move the
machine around, so I modified the system/install.scm in guix-0.8 and
ran:

   # guix system disk-image gnu/system/install.scm

I dropped "--image-size=800MiB" otherwise the image failed build.

   # dd if=/gnu/store/.image-disk of=/dev/sdb

When I boot the disk, I find out guix is version 0.7. I was under the
impression that this wasn't compatible with my system config.scm. So I
went back to guix-0.8 and changed package-mangement.scm recipe so that
guix is guix 0.8 instead of 0.7. There is also guix-devel but... This
was not very user friendly but hey, guix is alpha.

When the disk boots I connect to the wifi with the following commands

   # wpa_passphrase   > wpa.conf
   # wpa_supplicant -B -w -cwpa.conf

Then:

  # dhclient 

To create partitions I used the graphical cfdisk command, then format them with:

  # mkfs.ext4 -L  

I used two partition one for root another for home. I mounted only the
root partition (previous attempts I learned that it's not required to
mount home, but you need to create the home directory with the correct
permissions...):

  # mount -L root /mnt/

I copy pasted the config.scm to /mnt/etc/ that I had cooked started
cow-store with

  # deco start cow-store /mnt

I went swimming and when back GNU Guix was on my system :)

I did quite a bit of experiments to get nouveau drivers (libre nvidia
drivers) working. I remember trying them previously and they are (can
be) quiet good. I just tested http://minetest.net it reports that
nouveau drivers are kicking.

With slim-service, Xorg will look for a .xsession in $HOME and not
.xinitrc! I attached my .xsession file, but do not use it if you don't
have all the command available, otherwise xorg will loop-restart
indefinitly...


It's not the case anymore but at some point I had several version of
guix 0.7, 0.8-devel, and 0.9. Now I have only 0.9.

- Also su and sudo doesn't source /etc/profile.
- xterm was aweful, I installed st cf. suckless.scm I use ``guix -L
`pwd` -e "(let ((x (use-modules (suckless st)"`` command to
install st. I'm wondering if there is better way to do.

- I find my "nouveau hack" quiet ugly, but I'm not sure how the
situation can be improved (cf. config.scm)
- During my test, I failed to get XORG_DRI_DRIVER_PATH working (cf
(gnu services xorg)) , nix-os is the only distro to use it.
LIBGL_DRIVERS_PATH doesn't work either.
- I'm not sure anymore about .guix-profile link, whether it gets
created or not at some point.
- I don't know if it's on purpose but $HOME/.guix-profile/sbin is
missing from $PATH
- I need a hat.

At some point, I'm not sure why anymore, I had to chroot into the
installed guix from the installation disk, here is what I did:

# sh ./connect-to-wifi.sh
# mount --bind /dev /mnt/dev
# mount -t proc /proc /mnt/proc
# cp /etc/resolv.conf /mnt/etc/
# chroot /mnt /bin/sh
# source /etc/profile
# guix-builder --build-users-group=guixbuild &
# guix foo bar baz


I still need a service for wpa-supplicant at some point, but my
current configuration is good.

So far, so good.


Thanks guix people, all the best!


config.scm
Description: Binary data


.xsession
Description: Binary data


suckless.scm
Description: Binary data


[PATCH 1/4] build/python-build-system: Fix easy-install.pth collisions.

2014-12-14 Thread Federico Beffa
A patch to avoid python setuptools easy-install.pth collisions.

Regards,
Fede
From e63ee558fe702d429e2365b4757ddce029dc75ed Mon Sep 17 00:00:00 2001
From: Federico Beffa 
Date: Sat, 13 Dec 2014 22:19:08 +0100
Subject: [PATCH 1/4] build/python-build-system: Fix easy-install.pth
 collisions.

* guix/build/python-build-system.scm (fix-pth): New fix-pth phase.
---
 guix/build/python-build-system.scm | 32 +++-
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 2f3d04a..44f2639 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -105,19 +105,33 @@
 files)))
   bindirs)))
 
+(define* (fix-pth #:key name inputs outputs #:allow-other-keys)
+  (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
+ (site-packages (string-append out "/lib/python"
+   (get-python-version python)
+   "/site-packages"))
+ (easy-install-pth (string-append site-packages "/easy-install.pth"))
+ (new-pth (string-append site-packages "/" name ".pth")))
+(if (file-exists? easy-install-pth)
+(rename-file easy-install-pth new-pth
+
 (define %standard-phases
   ;; 'configure' and 'build' phases are not needed.  Everything is done during
   ;; 'install'.
-  (alist-cons-after
-   'install 'wrap
-   wrap
-   (alist-replace
-'build build
+  (alist-cons-before
+   'strip 'fix-pth
+   fix-pth
+   (alist-cons-after
+'install 'wrap
+wrap
 (alist-replace
- 'check check
- (alist-replace 'install install
-(alist-delete 'configure
-   gnu:%standard-phases))
+ 'build build
+ (alist-replace
+  'check check
+  (alist-replace 'install install
+ (alist-delete 'configure
+   gnu:%standard-phases)))
 
 (define* (python-build #:key inputs (phases %standard-phases)
#:allow-other-keys #:rest args)
-- 
1.8.4



[PATCH 2/4] gnu: Add xcffib

2014-12-14 Thread Federico Beffa
Fede
From f4187d31f95e3a65947d77bf267115906ed3816b Mon Sep 17 00:00:00 2001
From: Federico Beffa 
Date: Wed, 10 Dec 2014 20:36:58 +0100
Subject: [PATCH 2/4] gnu: Add xcffib

* gnu/packages/python.scm (python-xcffib, python2-xcffib): New variables.
---
 gnu/packages/python.scm | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 67effe7..9b3d721 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -50,6 +50,7 @@
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages which)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages xorg)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2541,3 +2542,44 @@ a front-end for C compilers or analysis tools.")
 
 (define-public python2-cffi
   (package-with-python2 python-cffi))
+
+(define-public python-xcffib
+  (package
+(name "python-xcffib")
+(version "0.1.9")
+(source
+ (origin
+  (method url-fetch)
+  (uri (string-append "https://pypi.python.org/packages/source/x/";
+  "xcffib/xcffib-" version ".tar.gz"))
+  (sha256
+   (base32
+"0655hzxv57h1a9ja9kwp0ichbkhf3djw32k33d66xp0q37dq2y81"
+(build-system python-build-system)
+(inputs
+ `(("libxcb" ,libxcb)
+   ("python-six" ,python-six)))
+(native-inputs
+ `(("python-setuptools" ,python-setuptools)))
+(propagated-inputs
+ `(("python-cffi" ,python-cffi)))
+(arguments
+ `(#:phases 
+   (alist-cons-after
+'install 'install-doc
+(lambda* (#:key outputs #:allow-other-keys)
+  (let ((doc (string-append (assoc-ref outputs "out") "/share"
+"/doc/" ,name "-" ,version)))
+(mkdir-p doc)
+(copy-file "README.md"
+   (string-append doc "/README.md"
+%standard-phases)))
+(home-page "https://github.com/tych0/xcffib";)
+(synopsis "XCB Python binding")
+(description
+ "A drop in replacement for xpyb, an XCB python binding.")
+(license expat)))
+
+(define-public python2-xcffib
+  (package-with-python2 python-xcffib))
+
-- 
1.8.4



[PATCH 3/4] gnu: Add cairocffi.

2014-12-14 Thread Federico Beffa
Fede
From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
From: Federico Beffa 
Date: Wed, 10 Dec 2014 21:05:59 +0100
Subject: [PATCH 3/4] gnu: Add cairocffi.

* gnu/packages/gtk.scm (python-cairocffi, python2-cairocffi): New variables.
---
 gnu/packages/gtk.scm | 57 
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index bcfe651..258a674 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -695,6 +695,63 @@ extensive documentation, including API reference and a tutorial.")
 ;; Dual-licensed under LGPL 2.1 or Mozilla Public License 1.1
 (license (list license:lgpl2.1 license:mpl1.1
 
+(define-public python-cairocffi
+  (package
+(name "python-cairocffi")
+(version "0.6")
+(source
+ (origin
+  (method url-fetch)
+  ;; The archive on pypi is missing the 'utils' directory!
+  (uri (string-append "https://github.com/SimonSapin/cairocffi/archive/v";
+  version ".tar.gz"))
+  (sha256
+   (base32
+"03w5p62sp3nqiccx864sbq0jvh7946277jqx3rcc3dch5xwfvv51"
+(build-system python-build-system)
+(outputs '("out" "doc"))
+(inputs
+ `(("gdk-pixbuf" ,gdk-pixbuf)
+   ("cairo" ,cairo)))
+(native-inputs
+ `(("pkg-config" ,pkg-config)
+   ("python-sphinx" ,python-sphinx)
+   ("python-docutils" ,python-docutils)
+   ("python-setuptools" ,python-setuptools)))
+(propagated-inputs
+ `(("python-xcffib" ,python-xcffib)))
+(arguments
+ `(#:phases 
+   (alist-cons-after
+'install 'install-doc
+(lambda* (#:key inputs outputs #:allow-other-keys)
+  (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
+ (doc (string-append data "/doc/" ,name "-" ,version))
+ (html (string-append doc "/html")))
+(setenv "LD_LIBRARY_PATH" 
+(string-append (assoc-ref inputs "cairo") "/lib" ":"
+   (assoc-ref inputs "gdk-pixbuf") "/lib"))
+(setenv "LANG" "en_US.UTF-8")
+(mkdir-p html)
+(for-each (lambda (file)
+(copy-file (string-append "." file)
+   (string-append doc file)))
+  '("/README.rst" "/CHANGES" "/LICENSE"))
+(system* "python" "setup.py" "build_sphinx")
+(copy-recursively "docs/_build/html" html)))
+%standard-phases)))
+(home-page "https://github.com/SimonSapin/cairocffi";)
+(synopsis "Python bindings and object-oriented API for Cairo")
+(description
+ "Cairocffi is a CFFI-based drop-in replacement for Pycairo, a set of
+Python bindings and object-oriented API for cairo.  Cairo is a 2D vector
+graphics library with support for multiple backends including image buffers,
+PNG, PostScript, PDF, and SVG file output.")
+(license license:bsd-3)))
+
+(define-public python2-cairocffi
+  (package-with-python2 python-cairocffi))
+
 (define-public python2-pygtk
   (package
 (name "python2-pygtk")
-- 
1.8.4



[PATCH 4/4] gnu: matplotlib: Add gtk3 backends.

2014-12-14 Thread Federico Beffa
This one is problematic: for the package to work the user has to define

export GI_TYPELIB_PATH=~/.guix-profile/lib/girepository-1.0

and

export LD_LIBRARY_PATH=~/.guix-profile/lib

The former is required to instruct 'gobject-introspection' where to
find typelib files and should be fine, but I'm not sure how to display
a message telling this at the end of the installation.

The latter is a hack. As discussed on another thread, the typelib
files have references to dynamic libraries and they do not include the
full path.  We are looking into a patch to add the full path into the
typelib files, however, the patch only works on newer versions of
'gobject-introspection' which breaks several other packages.

Setting this environment variable should be a temporary solution.

Regards,
Fede
From e1e3df22ea06bd7325bc2a1fd389c89f13ccf752 Mon Sep 17 00:00:00 2001
From: Federico Beffa 
Date: Thu, 11 Dec 2014 14:26:13 +0100
Subject: [PATCH 4/4] gnu: matplotlib: Add gtk3 backends.

* gnu/packages/python.scm (python-matplotlib, python2-matplotlib): Add
  necessary inputs and 'configure-environment' phase.
---
 gnu/packages/python.scm | 130 +---
 1 file changed, 89 insertions(+), 41 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 9b3d721..bd5c519 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -46,11 +46,14 @@
   #:use-module (gnu packages texlive)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages which)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2117,10 +2120,35 @@ that client code uses to construct the grammar directly in Python code.")
  "0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp"
 (build-system python-build-system)
 (outputs '("out" "doc"))
+(propagated-inputs
+ `(("python-pyparsing" ,python-pyparsing)
+   ("python-pygobject" ,python-pygobject)
+   ("gobject-introspection" ,gobject-introspection)
+   ;; The 'gtk+' package (and 'gdk-pixbuf', 'atk' and 'pango' propagated
+   ;; from 'gtk+') provides the required 'typelib' files used by
+   ;; 'gobject-introspection'. The location of these files is set with the
+   ;; help of the environment variable GI_TYPELIB_PATH. At build time this
+   ;; is done automatically by a 'native-search-path' procedure. However,
+   ;; at run-time the user must set this variable as follows:
+   ;;
+   ;; export GI_TYPELIB_PATH=~/.guix-profile/lib/girepository-1.0
+   ;;
+   ;; 'typelib' files include references to dynamic libraries. Currently
+   ;; the references do not include the full path to the libraries. For
+   ;; this reason the user must set the LD_LIBRARY_PATH to the location of 
+   ;; 'libgtk-3.so.0', 'libgdk-3.so.0' and 'libatk-1.0.so.0':
+   ;;
+   ;; export LD_LIBRARY_PATH=~/.guix-profile/lib
+   ("gtk+" ,gtk+)
+   ;; From version 1.4.0 'matplotlib' makes use of 'cairocffi' instead of
+   ;; 'pycairo'. However, 'pygobject' makes use of a 'pycairo' 'context'
+   ;; object. For this reason we need to import both libraries.
+   ;; https://pythonhosted.org/cairocffi/cffi_api.html#converting-pycairo
+   ("python-pycairo" ,python-pycairo)
+   ("python-cairocffi" ,python-cairocffi)))
 (inputs
  `(("python-setuptools" ,python-setuptools)
("python-dateutil" ,python-dateutil-2)
-   ("python-pyparsing" ,python-pyparsing)
("python-six" ,python-six)
("python-pytz" ,python-pytz)
("python-numpy" ,python-numpy-bootstrap)
@@ -2131,53 +2159,65 @@ that client code uses to construct the grammar directly in Python code.")
("libpng" ,libpng)
("imagemagick" ,imagemagick)
("freetype" ,freetype)
+   ("cairo" ,cairo)
+   ("glib" ,glib)
+   ("python-pillow" ,python-pillow)
;; FIXME: Add backends when available.
-   ;("python-pygtk" ,python-pygtk)
-   ;("python-pycairo" ,python-pycairo)
-   ;("python-pygobject" ,python-pygobject)
;("python-wxpython" ,python-wxpython)
;("python-pyqt" ,python-pyqt)
))
 (native-inputs
  `(("pkg-config" ,pkg-config)
("texlive" ,texlive)
+   ("ghostscript" ,ghostscript)
("texinfo" ,texinfo)))
 (arguments
  `(#:phases
-   (alist-cons-after
-'install 'install-doc
-(lambda* (#:key outputs #:allow-other-keys)
-  (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
- (doc (string-append data "/doc/" ,name "-" ,version))
- (info (string-appen

Re: [PATCH 1/4] build/python-build-system: Fix easy-install.pth collisions.

2014-12-14 Thread Ludovic Courtès
Federico Beffa  skribis:

> From e63ee558fe702d429e2365b4757ddce029dc75ed Mon Sep 17 00:00:00 2001
> From: Federico Beffa 
> Date: Sat, 13 Dec 2014 22:19:08 +0100
> Subject: [PATCH 1/4] build/python-build-system: Fix easy-install.pth
>  collisions.
>
> * guix/build/python-build-system.scm (fix-pth): New fix-pth phase.

A good idea.

> +(define* (fix-pth #:key name inputs outputs #:allow-other-keys)

What about calling it ‘rename-pth-file’, which should be more
descriptive?  Also please add a docstring.

> +  (let* ((out (assoc-ref outputs "out"))
> + (python (assoc-ref inputs "python"))
> + (site-packages (string-append out "/lib/python"
> +   (get-python-version python)
> +   "/site-packages"))
> + (easy-install-pth (string-append site-packages "/easy-install.pth"))
> + (new-pth (string-append site-packages "/" name ".pth")))
> +(if (file-exists? easy-install-pth)
> +(rename-file easy-install-pth new-pth

Please use ‘when’ instead of ‘if’, and add a trailing #t, to make it
clear that the phase succeeds.

Is PACKAGE.pth a common convention?  I mean, does Python (or
setuptools?) actually use files called PYTHON.pth?

Thanks for working on it!

Ludo’.



Re: 01/01: gnu: python-numpy-bootstrap: Reduce matrix size in failing test.

2014-12-14 Thread Ludovic Courtès
Federico Beffa  skribis:

> +(alist-cons-before
> + 'check 'fix-failing-tests
> + (lambda _
> +   (substitute* (find-files "numpy/linalg/tests" 
> +"test_regression\\.py")
> + (("x = np.eye(1000, 66)")
> +  "x = np.eye(10, 66)")))

Could you add a comment here explaining that this is reducing the input
matrix size (?) and why it matters?  Otherwise it may seem a bit too
magical.  :-)

Also, this kind of change would be a good candidate for ‘snippet’,
because it’s a “static” change.

Thanks,
Ludo’.



Invalid nar signature

2014-12-14 Thread David Thompson
Hello everyone,

While working on a new guix command, called 'guix publish', I've run
into a snag.  The archives I've exported via export-paths in the (guix
store) module are rejected by 'guix substitute-binary' due to the nar
signature being invalid.  The signature is a string containing
"nix-archive-1" at the head of the file.  I can clearly see that text
there, but the read-string operation that happens in the restore-file
procedure in (guix serialization) says otherwise.

The output of the following code in the context of the
(guix serialization) module is "\r", it should be "nix-archive-1":

  (with-input-from-file "some-nar-file"
(lambda ()
  (read-string (current-input-port

Does anyone know what I'm missing here?  Thanks in advance.

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate



Re: Invalid nar signature

2014-12-14 Thread David Thompson
David Thompson  writes:

> The output of the following code in the context of the
> (guix serialization) module is "\r", it should be "nix-archive-1":
>
>   (with-input-from-file "some-nar-file"
> (lambda ()
>   (read-string (current-input-port

Also, note that the following code *does* yield "nix-archive-1":

   (with-input-from-file "some-nar-file"
 (lambda ()
   (read-int (current-input-port))
   (read-string (current-input-port

So, if I remove the first 8 bytes of the file (which when read as an
integer is 1), things look good.  What's going on here?

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate