* [PATCH] gnu: Add matplotlib.
@ 2014-11-27 19:32 Federico Beffa
2014-11-29 21:05 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2014-11-27 19:32 UTC (permalink / raw)
To: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]
Hi,
attached you find a patch for matplotlib.
For python2-matplotlib I've noticed a behavior that I do not
understand: matplotlib depends on numpydoc which I pushed yesterday
and appears not to be ready yet on hydra. If I build
python2-matplotlib with
./pre-inst-env guix build python2-matplotlib
guix tells me that it will build among other packages
/gnu/store/gjfrir5iykxwxicp9dxjv3adk5vpifb4-python2-numpydoc-0.5.drv
However, the build process for this package fails, because a test
fails. Since I prepared the numpydoc package I know about this test
and know that the package includes the parameter #:tests? #f.
In fact, if I explicitly build python2-numpydoc with
./pre-inst-env guix build python2-numpydoc
it finished successfully (skipping the tests).
The two ways of causing numpydoc to be built (direct and indirect)
generate two independent
/gnu/store/...-python2-numpydoc-0.5-guile-builder
The one generated by an explicit build command includes the #:tests?
#f flag as expected. However, the indirect one includes a #:tests? #t
flag! I'm confused. Am I missing something?
Here the definition of python2-numpydoc:
(define-public python2-numpydoc
(package
(inherit (package-with-python2 python-numpydoc))
;; With python-2 1 test (out of 30) fails because it doesn't find
;; matplotlib. With python-3 it seems to detect at run-time the absence
;; of matplotlib.
(arguments `(#:tests? #f
#:python ,python-2))))
Thanks for your advice.
Regards,
Fede
[-- Attachment #2: 0001-gnu-Add-matplotlib.patch --]
[-- Type: text/x-patch, Size: 4865 bytes --]
From d9d7c9aedb1f0d970280d32bc0a9f3cf7019784c Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Thu, 27 Nov 2014 20:11:53 +0100
Subject: [PATCH] gnu: Add matplotlib.
* gnu/packages/python.scm (python-matplotlib, python2-matplotlib): New
variables.
---
gnu/packages/python.scm | 92 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 68dc67f..150f4a1 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -41,6 +41,11 @@
#:use-module (gnu packages databases)
#:use-module (gnu packages zip)
#:use-module (gnu packages multiprecision)
+ #:use-module (gnu packages texlive)
+ #:use-module (gnu packages texinfo)
+ #:use-module (gnu packages image)
+ #:use-module (gnu packages imagemagick)
+ #:use-module (gnu packages fontutils)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
@@ -2015,3 +2020,90 @@ that client code uses to construct the grammar directly in Python code.")
;; of matplotlib.
(arguments `(#:tests? #f
#:python ,python-2))))
+
+(define-public python-matplotlib
+ (package
+ (name "python-matplotlib")
+ (version "1.4.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/matplotlib"
+ "/matplotlib-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp"))))
+ (build-system python-build-system)
+ (outputs '("out" "doc"))
+ (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)
+ ("python-sphinx" ,python-sphinx)
+ ("python-numpydoc" ,python-numpydoc)
+ ("python-nose" ,python-nose)
+ ("libpng" ,libpng)
+ ("imagemagick" ,imagemagick)
+ ("freetype" ,freetype)
+ ;; FIX-ME: 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)
+ ("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-append data "/info"))
+ (html (string-append doc "/html")))
+ (with-directory-excursion "doc"
+ ;; Without setting this variable we get an encoding error.
+ (setenv "LANG" "en_US.UTF-8")
+ ;; Produce pdf in 'A4' format.
+ (substitute* (find-files "." "conf\\.py")
+ (("latex_paper_size = 'letter'")
+ "latex_paper_size = 'a4'"))
+ (mkdir-p html)
+ (mkdir-p info)
+ ;; The doc recommends to run the 'html' target twice.
+ (system* "python" "make.py" "html")
+ (system* "python" "make.py" "html")
+ (system* "python" "make.py" "latex")
+ (system* "python" "make.py" "texinfo")
+ (copy-file "build/texinfo/matplotlib.info"
+ (string-append info "/matplotlib.info"))
+ (copy-file "build/latex/Matplotlib.pdf"
+ (string-append doc "/Matplotlib.pdf"))
+ (with-directory-excursion "build/html"
+ (map (lambda (file)
+ (let* ((dir (dirname file))
+ (tgt-dir (string-append html "/" dir)))
+ (unless (equal? "." dir)
+ (mkdir-p tgt-dir))
+ (copy-file file (string-append html "/" file))))
+ (find-files "." ".*"))))))
+ %standard-phases)))
+ (home-page "http://matplotlib.org")
+ (synopsis "2D plotting library for Python")
+ (description
+ "Matplotlib is a Python 2D plotting library which produces publication
+quality figures in a variety of hardcopy formats and interactive environments
+across platforms. Matplotlib can be used in Python scripts, the python and
+ipython shell, web application servers, and six graphical user interface
+toolkits.")
+ (license psfl)))
+
+(define-public python2-matplotlib
+ (package-with-python2 python-matplotlib))
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gnu: Add matplotlib.
2014-11-27 19:32 [PATCH] gnu: Add matplotlib Federico Beffa
@ 2014-11-29 21:05 ` Ludovic Courtès
2014-11-30 16:01 ` Federico Beffa
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2014-11-29 21:05 UTC (permalink / raw)
To: Federico Beffa; +Cc: Guix-devel
Federico Beffa <beffa@ieee.org> skribis:
> For python2-matplotlib I've noticed a behavior that I do not
> understand: matplotlib depends on numpydoc which I pushed yesterday
> and appears not to be ready yet on hydra. If I build
> python2-matplotlib with
>
> ./pre-inst-env guix build python2-matplotlib
>
> guix tells me that it will build among other packages
>
> /gnu/store/gjfrir5iykxwxicp9dxjv3adk5vpifb4-python2-numpydoc-0.5.drv
>
> However, the build process for this package fails, because a test
> fails. Since I prepared the numpydoc package I know about this test
> and know that the package includes the parameter #:tests? #f.
>
> In fact, if I explicitly build python2-numpydoc with
>
> ./pre-inst-env guix build python2-numpydoc
>
> it finished successfully (skipping the tests).
>
> The two ways of causing numpydoc to be built (direct and indirect)
> generate two independent
>
> /gnu/store/...-python2-numpydoc-0.5-guile-builder
>
> The one generated by an explicit build command includes the #:tests?
> #f flag as expected. However, the indirect one includes a #:tests? #t
> flag! I'm confused. Am I missing something?
What happens is that ‘package-with-python2’ automatically generates
python2 variants of the dependencies of the package you give it. So
(package-with-python2 python-matplotlib) generates a package with an
input that is exactly (package-with-python2 python-numpydoc), hence with
#:tests? #t.
The fix is to explicitly use the right python2-numpydoc, along the lines
of:
(define-public python2-matplotlib
(let ((matplotlib (package-with-python2 python-matplotlib)))
(package (inherit matplotlib)
;; Make sure we use exactly PYTHON2-NUMPYDOC, which is
;; customized for Python 2.
(inputs `(("numpydoc" ,python2-numpydoc)
,@(alist-delete "numpydoc" (package-inputs matplotlib)))))))
> + ;; FIX-ME: Add backends when available.
Please write “FIXME” for easier grepping and highlighting.
Otherwise the patch looks good to me, thanks for working on it!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gnu: Add matplotlib.
2014-11-29 21:05 ` Ludovic Courtès
@ 2014-11-30 16:01 ` Federico Beffa
2014-11-30 17:00 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2014-11-30 16:01 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Guix-devel
On Sat, Nov 29, 2014 at 10:05 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> What happens is that ‘package-with-python2’ automatically generates
> python2 variants of the dependencies of the package you give it. So
> (package-with-python2 python-matplotlib) generates a package with an
> input that is exactly (package-with-python2 python-numpydoc), hence with
> #:tests? #t.
Oh, I see. Wouldn't it be better if, for each input,
'pyckage-with-python2' would check if in (gnu packages python) a
variable with prefix 'python2-' is defined and, in case it is, use
that variable instead of constructing new package?
>
> The fix is to explicitly use the right python2-numpydoc, along the lines
> of:
>
> (define-public python2-matplotlib
> (let ((matplotlib (package-with-python2 python-matplotlib)))
> (package (inherit matplotlib)
> ;; Make sure we use exactly PYTHON2-NUMPYDOC, which is
> ;; customized for Python 2.
> (inputs `(("numpydoc" ,python2-numpydoc)
> ,@(alist-delete "numpydoc" (package-inputs matplotlib)))))))
>
>
>> + ;; FIX-ME: Add backends when available.
>
> Please write “FIXME” for easier grepping and highlighting.
>
> Otherwise the patch looks good to me, thanks for working on it!
I've corrected these two items and pushed the patch.
Thanks for the clarification!
Fede
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gnu: Add matplotlib.
2014-11-30 16:01 ` Federico Beffa
@ 2014-11-30 17:00 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2014-11-30 17:00 UTC (permalink / raw)
To: Federico Beffa; +Cc: Guix-devel
Federico Beffa <beffa@ieee.org> skribis:
> On Sat, Nov 29, 2014 at 10:05 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> What happens is that ‘package-with-python2’ automatically generates
>> python2 variants of the dependencies of the package you give it. So
>> (package-with-python2 python-matplotlib) generates a package with an
>> input that is exactly (package-with-python2 python-numpydoc), hence with
>> #:tests? #t.
>
> Oh, I see. Wouldn't it be better if, for each input,
> 'pyckage-with-python2' would check if in (gnu packages python) a
> variable with prefix 'python2-' is defined and, in case it is, use
> that variable instead of constructing new package?
No, I think this is not desirable. Variable names are for us humans,
and programs shouldn’t try to guess what’s meant by browsing module name
spaces.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-30 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 19:32 [PATCH] gnu: Add matplotlib Federico Beffa
2014-11-29 21:05 ` Ludovic Courtès
2014-11-30 16:01 ` Federico Beffa
2014-11-30 17:00 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.