unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 3/4] gnu: Add cairocffi.
@ 2014-12-14 19:41 Federico Beffa
  2014-12-15 22:18 ` Ludovic Courtès
  2014-12-18 19:53 ` Mark H Weaver
  0 siblings, 2 replies; 6+ messages in thread
From: Federico Beffa @ 2014-12-14 19:41 UTC (permalink / raw)
  To: Guix-devel

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

Fede

[-- Attachment #2: 0003-gnu-Add-cairocffi.patch --]
[-- Type: text/x-patch, Size: 3186 bytes --]

From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
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


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

* Re: [PATCH 3/4] gnu: Add cairocffi.
  2014-12-14 19:41 [PATCH 3/4] gnu: Add cairocffi Federico Beffa
@ 2014-12-15 22:18 ` Ludovic Courtès
  2014-12-18 19:53 ` Mark H Weaver
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2014-12-15 22:18 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> 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.

[...]

> +    (propagated-inputs
> +     `(("python-xcffib" ,python-xcffib)))

Please add a comment to explain.

OK to push with this change, thanks!

Ludo’.

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

* Re: [PATCH 3/4] gnu: Add cairocffi.
  2014-12-14 19:41 [PATCH 3/4] gnu: Add cairocffi Federico Beffa
  2014-12-15 22:18 ` Ludovic Courtès
@ 2014-12-18 19:53 ` Mark H Weaver
  2014-12-18 21:05   ` Federico Beffa
  1 sibling, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2014-12-18 19:53 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> writes:

> From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> 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.

[...]

> +(define-public python2-cairocffi
> +  (package-with-python2 python-cairocffi))
> +

This commit breaks the Guix build for me.

Due to complications arising from circular module dependencies, we can't
use 'package-with-python2' from gtk.scm.  For now, I suggest moving it
to python.scm, where all other uses of 'package-with-python2' are
currently located.

If you'd like to understand the reasons, read on (optional).

The reason is that gtk.scm and python.scm are part of the same strongly
connected component (SCC) in the graph of "use-module" dependencies.  In
other words, there exists a cycle containing both of them (in this case
they use each other directly).  This prevents Guile from loading the
modules in "bottom-up" order, and there's no guarantee which one will be
loaded first.

In this case, if gtk.scm is loaded first, it works, but if python.scm is
loaded first, you're out of luck.

If python.scm is loaded first, it starts by loading the modules it uses,
including gtk.scm.  Then gtk.scm loads the modules it uses including
python.scm.  This would lead to infinite recursion, but Guile breaks the
cycle by ignoring the attempt load python.scm when it's currently being
loaded.  gtk.scm then continues to load, and gets to your definition of
'python2-cairocffi', which tries to call 'package-with-python2' before
python.scm has been fully loaded (in fact it's hardly loaded at all).

In Guix package modules this is usually not a problem, because most of
the inter-module variable references are in "thunked" fields such as
'inputs', and thunked fields are not evaluated until later.  However,
the definition of 'python2-cairocffi' needs to call
'package-with-python2' at module-load time, and python.scm may not be
loaded yet at that point.

So 'python2-cairocffi' must either be moved out of the SCC containing
python.scm, or moved into python.scm at a point late enough in the file
such that everything needed by 'package-with-python2' has already been
loaded.

We currently have two non-trivial SCCs in our "use-module" graph of
package modules.  One is ((gnu packages bison) (gnu packages flex)),
and the other one is rather large:

((gnu packages boost)
 (gnu packages python)
 (gnu packages image)
 (gnu packages fontutils)
 (gnu packages ghostscript)
 (gnu packages tcl)
 (gnu packages xorg)
 (gnu packages gettext)
 (gnu packages xml)
 (gnu packages gnupg)
 (gnu packages curl)
 (gnu packages gnutls)
 (gnu packages guile)
 (gnu packages gtk)
 (gnu packages glib)
 (gnu packages base)
 (gnu packages acl)
 (gnu packages attr)
 (gnu packages linux)
 (gnu packages databases)
 (gnu packages emacs)
 (gnu packages lesstif)
 (gnu packages version-control)
 (gnu packages cook)
 (gnu packages groff)
 (gnu packages netpbm)
 (gnu packages nano)
 (gnu packages admin)
 (gnu packages swig)
 (gnu packages imagemagick)
 (gnu packages algebra)
 (gnu packages mpi)
 (gnu packages valgrind)
 (gnu packages gdb)
 (gnu packages dejagnu)
 (gnu packages graphviz)
 (gnu packages gd)
 (gnu packages w3m)
 (gnu packages wget)
 (gnu packages web)
 (gnu packages asciidoc)
 (gnu packages docbook)
 (gnu packages inkscape)
 (gnu packages maths)
 (gnu packages cmake)
 (gnu packages backup)
 (gnu packages rsync)
 (gnu packages ssh)
 (gnu packages fltk)
 (gnu packages gl)
 (gnu packages xdisorg)
 (gnu packages lisp)
 (gnu packages texlive)
 (gnu packages pdf)
 (gnu packages tcsh)
 (gnu packages zip)
 (gnu packages gnome)
 (gnu packages gstreamer)
 (gnu packages pulseaudio)
 (gnu packages avahi)
 (gnu packages libcanberra)
 (gnu packages xiph)
 (gnu packages doxygen)
 (gnu packages iso-codes)
 (gnu packages mp3)
 (gnu packages cdrom)
 (gnu packages man)
 (gnu packages lynx)
 (gnu packages rrdtool)
 (gnu packages gsasl)
 (gnu packages shishi)
 (gnu packages openldap))

     Mark

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

* Re: [PATCH 3/4] gnu: Add cairocffi.
  2014-12-18 19:53 ` Mark H Weaver
@ 2014-12-18 21:05   ` Federico Beffa
  2014-12-18 22:20     ` Mark H Weaver
  0 siblings, 1 reply; 6+ messages in thread
From: Federico Beffa @ 2014-12-18 21:05 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Guix-devel

On Thu, Dec 18, 2014 at 8:53 PM, Mark H Weaver <mhw@netris.org> wrote:
> Federico Beffa <beffa@ieee.org> writes:
>
>> From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
>> From: Federico Beffa <beffa@fbengineering.ch>
>> 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.
>
> [...]
>
>> +(define-public python2-cairocffi
>> +  (package-with-python2 python-cairocffi))
>> +
>
> This commit breaks the Guix build for me.
>
> Due to complications arising from circular module dependencies, we can't
> use 'package-with-python2' from gtk.scm.  For now, I suggest moving it
> to python.scm, where all other uses of 'package-with-python2' are
> currently located.

I just moved cairocffi to the python module and committed.  Sorry about that!

I worked on it and with packages depending on it for several days
without problems. How is it that the import is not deterministic?

Regards,
Fede

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

* Re: [PATCH 3/4] gnu: Add cairocffi.
  2014-12-18 21:05   ` Federico Beffa
@ 2014-12-18 22:20     ` Mark H Weaver
  2014-12-19 17:57       ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2014-12-18 22:20 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> writes:

> On Thu, Dec 18, 2014 at 8:53 PM, Mark H Weaver <mhw@netris.org> wrote:
>> Federico Beffa <beffa@ieee.org> writes:
>>
>>> From e853d10b595ece0003d838cbfffa65e29a6c2e68 Mon Sep 17 00:00:00 2001
>>> From: Federico Beffa <beffa@fbengineering.ch>
>>> 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.
>>
>> [...]
>>
>>> +(define-public python2-cairocffi
>>> +  (package-with-python2 python-cairocffi))
>>> +
>>
>> This commit breaks the Guix build for me.
>>
>> Due to complications arising from circular module dependencies, we can't
>> use 'package-with-python2' from gtk.scm.  For now, I suggest moving it
>> to python.scm, where all other uses of 'package-with-python2' are
>> currently located.
>
> I just moved cairocffi to the python module and committed.  Sorry about that!

Thanks, and no worries!  I don't think any of us could have anticipated
this problem.

> I worked on it and with packages depending on it for several days
> without problems. How is it that the import is not deterministic?

It depends on which module in that large SCC is loaded first into a
given Guile session.

It should be deterministic for any given Guile session, e.g. for any
given *.scm file that is being compiled by 'guild compile', or for any
given set of commands typed into a freshly loaded Guile.

I saw the problem when compiling inkscape.scm.  Other files might have
failed as well, but 'make' stopped when inkscape.scm failed.  I guess
you didn't recompile any of the files that exhibited the problem since
adding 'python2-cairocffi', which is reasonable :)

I hope to eventually add some mechanism to detect and/or avoid these
problems in the future.  In the meantime, we'll just have to accept that
this problem will occasionally bite us.  I don't think it's reasonable
to expect people to do a "make clean-go && make" every time they add a
package.  IMO, that cure would be worse than the disease.

     Regards,
       Mark

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

* Re: [PATCH 3/4] gnu: Add cairocffi.
  2014-12-18 22:20     ` Mark H Weaver
@ 2014-12-19 17:57       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2014-12-19 17:57 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Guix-devel, Federico Beffa

Mark H Weaver <mhw@netris.org> skribis:

> I hope to eventually add some mechanism to detect and/or avoid these
> problems in the future.  In the meantime, we'll just have to accept that
> this problem will occasionally bite us.  I don't think it's reasonable
> to expect people to do a "make clean-go && make" every time they add a
> package.  IMO, that cure would be worse than the disease.

Right.  And yes, we’ll need a better solution.

> This commit breaks the Guix build for me.
>
> Due to complications arising from circular module dependencies, we can't
> use 'package-with-python2' from gtk.scm.  For now, I suggest moving it
> to python.scm, where all other uses of 'package-with-python2' are
> currently located.
>
> If you'd like to understand the reasons, read on (optional).

Thanks for catching it, for explaining, and to Federico for the quick
fix!

Ludo’.

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

end of thread, other threads:[~2014-12-19 17:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-14 19:41 [PATCH 3/4] gnu: Add cairocffi Federico Beffa
2014-12-15 22:18 ` Ludovic Courtès
2014-12-18 19:53 ` Mark H Weaver
2014-12-18 21:05   ` Federico Beffa
2014-12-18 22:20     ` Mark H Weaver
2014-12-19 17:57       ` 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).