gnu: matplotlib: Add gtk3 backends and optional dependency. Adjust inputs.
* gnu/packages/python.scm (python-matplotlib, python2-matplotlib): Add gtk3 backends with the necessary inputs and a 'configure-environment' phase. Add the optional 'python-pillow' dependency. Move 'python-pyparsing' from 'inputs' to 'propagated-inputs' as it is required at run time.
This commit is contained in:
parent
63cd6e5a95
commit
25f9a068f2
|
@ -51,6 +51,8 @@
|
||||||
#:use-module (gnu packages which)
|
#:use-module (gnu packages which)
|
||||||
#:use-module (gnu packages perl)
|
#:use-module (gnu packages perl)
|
||||||
#:use-module (gnu packages xorg)
|
#:use-module (gnu packages xorg)
|
||||||
|
#:use-module (gnu packages glib)
|
||||||
|
#:use-module (gnu packages gtk)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
|
@ -2118,10 +2120,35 @@ that client code uses to construct the grammar directly in Python code.")
|
||||||
"0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp"))))
|
"0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp"))))
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
(outputs '("out" "doc"))
|
(outputs '("out" "doc"))
|
||||||
|
(propagated-inputs ; the following packages are all needed at run time
|
||||||
|
`(("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
|
(inputs
|
||||||
`(("python-setuptools" ,python-setuptools)
|
`(("python-setuptools" ,python-setuptools)
|
||||||
("python-dateutil" ,python-dateutil-2)
|
("python-dateutil" ,python-dateutil-2)
|
||||||
("python-pyparsing" ,python-pyparsing)
|
|
||||||
("python-six" ,python-six)
|
("python-six" ,python-six)
|
||||||
("python-pytz" ,python-pytz)
|
("python-pytz" ,python-pytz)
|
||||||
("python-numpy" ,python-numpy-bootstrap)
|
("python-numpy" ,python-numpy-bootstrap)
|
||||||
|
@ -2132,10 +2159,10 @@ that client code uses to construct the grammar directly in Python code.")
|
||||||
("libpng" ,libpng)
|
("libpng" ,libpng)
|
||||||
("imagemagick" ,imagemagick)
|
("imagemagick" ,imagemagick)
|
||||||
("freetype" ,freetype)
|
("freetype" ,freetype)
|
||||||
|
("cairo" ,cairo)
|
||||||
|
("glib" ,glib)
|
||||||
|
("python-pillow" ,python-pillow)
|
||||||
;; FIXME: Add backends when available.
|
;; FIXME: Add backends when available.
|
||||||
;("python-pygtk" ,python-pygtk)
|
|
||||||
;("python-pycairo" ,python-pycairo)
|
|
||||||
;("python-pygobject" ,python-pygobject)
|
|
||||||
;("python-wxpython" ,python-wxpython)
|
;("python-wxpython" ,python-wxpython)
|
||||||
;("python-pyqt" ,python-pyqt)
|
;("python-pyqt" ,python-pyqt)
|
||||||
))
|
))
|
||||||
|
@ -2145,40 +2172,51 @@ that client code uses to construct the grammar directly in Python code.")
|
||||||
("texinfo" ,texinfo)))
|
("texinfo" ,texinfo)))
|
||||||
(arguments
|
(arguments
|
||||||
`(#:phases
|
`(#:phases
|
||||||
(alist-cons-after
|
(alist-cons-before
|
||||||
'install 'install-doc
|
'build 'configure-environment
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs inputs #:allow-other-keys)
|
||||||
(let* ((data (string-append (assoc-ref outputs "doc") "/share"))
|
(let ((cairo (assoc-ref inputs "cairo"))
|
||||||
(doc (string-append data "/doc/" ,name "-" ,version))
|
(gtk+ (assoc-ref inputs "gtk+")))
|
||||||
(info (string-append data "/info"))
|
;; Setting these directories in the 'basedirlist' of 'setup.cfg'
|
||||||
(html (string-append doc "/html")))
|
;; has not effect.
|
||||||
(with-directory-excursion "doc"
|
;;
|
||||||
;; Without setting this variable we get an encoding error.
|
;; FIXME: setting LD_LIBRARY_PATH should be removed once we patch
|
||||||
(setenv "LANG" "en_US.UTF-8")
|
;; gobject-introspection to include the full path of shared
|
||||||
;; Produce pdf in 'A4' format.
|
;; libraries in 'typelib' files.
|
||||||
(substitute* (find-files "." "conf\\.py")
|
(setenv "LD_LIBRARY_PATH"
|
||||||
(("latex_paper_size = 'letter'")
|
(string-append cairo "/lib:" gtk+ "/lib"))
|
||||||
"latex_paper_size = 'a4'"))
|
(setenv "HOME" (getcwd))
|
||||||
(mkdir-p html)
|
(call-with-output-file "setup.cfg"
|
||||||
(mkdir-p info)
|
(lambda (port)
|
||||||
;; The doc recommends to run the 'html' target twice.
|
(format port "[rc_options]~%
|
||||||
(system* "python" "make.py" "html")
|
backend = GTK3Agg~%")))))
|
||||||
(system* "python" "make.py" "html")
|
(alist-cons-after
|
||||||
(system* "python" "make.py" "latex")
|
'install 'install-doc
|
||||||
(system* "python" "make.py" "texinfo")
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(copy-file "build/texinfo/matplotlib.info"
|
(let* ((data (string-append (assoc-ref outputs "doc") "/share"))
|
||||||
(string-append info "/matplotlib.info"))
|
(doc (string-append data "/doc/" ,name "-" ,version))
|
||||||
(copy-file "build/latex/Matplotlib.pdf"
|
(info (string-append data "/info"))
|
||||||
(string-append doc "/Matplotlib.pdf"))
|
(html (string-append doc "/html")))
|
||||||
(with-directory-excursion "build/html"
|
(with-directory-excursion "doc"
|
||||||
(map (lambda (file)
|
;; Without setting this variable we get an encoding error.
|
||||||
(let* ((dir (dirname file))
|
(setenv "LANG" "en_US.UTF-8")
|
||||||
(tgt-dir (string-append html "/" dir)))
|
;; Produce pdf in 'A4' format.
|
||||||
(unless (equal? "." dir)
|
(substitute* (find-files "." "conf\\.py")
|
||||||
(mkdir-p tgt-dir))
|
(("latex_paper_size = 'letter'")
|
||||||
(copy-file file (string-append html "/" file))))
|
"latex_paper_size = 'a4'"))
|
||||||
(find-files "." ".*"))))))
|
(mkdir-p html)
|
||||||
%standard-phases)))
|
(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"))
|
||||||
|
(copy-recursively "build/html" html))))
|
||||||
|
%standard-phases))))
|
||||||
(home-page "http://matplotlib.org")
|
(home-page "http://matplotlib.org")
|
||||||
(synopsis "2D plotting library for Python")
|
(synopsis "2D plotting library for Python")
|
||||||
(description
|
(description
|
||||||
|
@ -2194,9 +2232,17 @@ toolkits.")
|
||||||
(package (inherit matplotlib)
|
(package (inherit matplotlib)
|
||||||
;; Make sure we use exactly PYTHON2-NUMPYDOC, which is
|
;; Make sure we use exactly PYTHON2-NUMPYDOC, which is
|
||||||
;; customized for Python 2.
|
;; customized for Python 2.
|
||||||
(inputs `(("python2-numpydoc" ,python2-numpydoc)
|
(propagated-inputs
|
||||||
,@(alist-delete "python-numpydoc"
|
`(("python2-py2cairo" ,python2-py2cairo)
|
||||||
(package-inputs matplotlib)))))))
|
("python2-pygobject-2" ,python2-pygobject-2)
|
||||||
|
,@(alist-delete "python-pycairo"
|
||||||
|
(alist-delete "python-pygobject"
|
||||||
|
(package-propagated-inputs
|
||||||
|
matplotlib)))))
|
||||||
|
(inputs
|
||||||
|
`(("python2-numpydoc" ,python2-numpydoc)
|
||||||
|
,@(alist-delete "python-numpydoc"
|
||||||
|
(package-inputs matplotlib)))))))
|
||||||
|
|
||||||
;; Scipy 0.14.0 with Numpy 0.19.X fails several tests. This is known and
|
;; Scipy 0.14.0 with Numpy 0.19.X fails several tests. This is known and
|
||||||
;; planned to be fixed in 0.14.1. It is claimed that the failures can safely
|
;; planned to be fixed in 0.14.1. It is claimed that the failures can safely
|
||||||
|
|
Loading…
Reference in New Issue