gnu: python-matplotlib-documentation: Fix build.

* gnu/packages/python.scm (python-matplotlib-documentation)[native-inputs]:
Add python-mock and graphviz.
[arguments]: Use separate build and install phases; correctly set latex paper size.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
This commit is contained in:
Thomas Danckaert 2017-03-08 13:53:08 +01:00 committed by Marius Bakke
parent 9c974c9366
commit 1eaaea41e5
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 31 additions and 30 deletions

View File

@ -3968,6 +3968,8 @@ toolkits.")
("python-sphinx" ,python-sphinx) ("python-sphinx" ,python-sphinx)
("python-numpydoc" ,python-numpydoc) ("python-numpydoc" ,python-numpydoc)
("python-ipython" ,python-ipython) ("python-ipython" ,python-ipython)
("python-mock" ,python-mock)
("graphviz" ,graphviz)
("texlive" ,texlive) ("texlive" ,texlive)
("texinfo" ,texinfo) ("texinfo" ,texinfo)
,@(package-native-inputs python-matplotlib))) ,@(package-native-inputs python-matplotlib)))
@ -3975,42 +3977,41 @@ toolkits.")
`(#:tests? #f ; we're only generating documentation `(#:tests? #f ; we're only generating documentation
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(delete 'build) (replace 'build
(lambda _
(chdir "doc")
;; Produce pdf in 'A4' format.
(substitute* "conf.py"
(("latex_paper_size = 'letter'") "")
;; latex_paper_size is deprecated -> set paper size using
;; latex_elements
(("latex_elements\\['pointsize'\\] = '11pt'" match)
;; insert at a point where latex_elements{} is defined:
(string-append match "\nlatex_elements['papersize'] = 'a4paper'")))
(zero? (system* "python" "make.py" "html" "latex" "texinfo"))))
(replace 'install (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((data (string-append (assoc-ref outputs "out") "/share")) (let* ((data (string-append (assoc-ref outputs "out") "/share"))
(doc (string-append data "/doc/" ,name "-" ,version)) (doc (string-append data "/doc/python-matplotlib-" ,version))
(info (string-append data "/info")) (info (string-append data "/info"))
(html (string-append doc "/html"))) (html (string-append doc "/html")))
;; Make installed package available for building the (mkdir-p html)
;; documentation (mkdir-p info)
(with-directory-excursion "doc" (copy-recursively "build/html" html)
;; Produce pdf in 'A4' format. (symlink (string-append html "/_images")
(substitute* (find-files "." "conf\\.py") (string-append info "/matplotlib-figures"))
(("latex_paper_size = 'letter'") (with-directory-excursion "build/texinfo"
"latex_paper_size = 'a4'")) (substitute* "matplotlib.texi"
(mkdir-p html) (("@image\\{([^,]*)" all file)
(mkdir-p info) (string-append "@image{matplotlib-figures/" file)))
;; The doc recommends to run the 'html' target twice.
(system* "python" "make.py" "html")
(system* "python" "make.py" "html")
(copy-recursively "build/html" html)
(system* "python" "make.py" "latex")
(system* "python" "make.py" "texinfo")
(symlink (string-append html "/_images") (symlink (string-append html "/_images")
(string-append info "/matplotlib-figures")) "./matplotlib-figures")
(with-directory-excursion "build/texinfo" (system* "makeinfo" "--no-split"
(substitute* "matplotlib.texi" "-o" "matplotlib.info" "matplotlib.texi"))
(("@image\\{([^,]*)" all file) (copy-file "build/texinfo/matplotlib.info"
(string-append "@image{matplotlib-figures/" file))) (string-append info "/matplotlib.info"))
(symlink (string-append html "/_images") (copy-file "build/latex/Matplotlib.pdf"
"./matplotlib-figures") (string-append doc "/Matplotlib.pdf")))
(system* "makeinfo" "--no-split"
"-o" "matplotlib.info" "matplotlib.texi"))
(copy-file "build/texinfo/matplotlib.info"
(string-append info "/matplotlib.info"))
(copy-file "build/latex/Matplotlib.pdf"
(string-append doc "/Matplotlib.pdf"))))
#t))))) #t)))))
(home-page (package-home-page python-matplotlib)) (home-page (package-home-page python-matplotlib))
(synopsis "Documentation for the python-matplotlib package") (synopsis "Documentation for the python-matplotlib package")