gnu: python-matplotlib: Use 'modify-phases' syntax.

* gnu/packages/python.scm (python-matplotlib)[arguments]: Use 'modify-phases'.
This commit is contained in:
Danny Milosavljevic 2017-01-14 22:03:54 +01:00
parent 9a8acd00da
commit 42b7009a00
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
1 changed files with 50 additions and 52 deletions

View File

@ -3723,62 +3723,60 @@ transcendental functions).")
("texinfo" ,texinfo))) ("texinfo" ,texinfo)))
(arguments (arguments
`(#:phases `(#:phases
(alist-cons-before (modify-phases %standard-phases
'build 'configure-environment (add-before 'build 'configure-environment
(lambda* (#:key outputs inputs #:allow-other-keys) (lambda* (#:key outputs inputs #:allow-other-keys)
(let ((cairo (assoc-ref inputs "cairo")) (let ((cairo (assoc-ref inputs "cairo"))
(gtk+ (assoc-ref inputs "gtk+"))) (gtk+ (assoc-ref inputs "gtk+")))
;; Setting these directories in the 'basedirlist' of 'setup.cfg' ;; Setting these directories in the 'basedirlist' of 'setup.cfg'
;; has not effect. ;; has not effect.
(setenv "LD_LIBRARY_PATH" (setenv "LD_LIBRARY_PATH"
(string-append cairo "/lib:" gtk+ "/lib")) (string-append cairo "/lib:" gtk+ "/lib"))
(setenv "HOME" (getcwd)) (setenv "HOME" (getcwd))
(call-with-output-file "setup.cfg" (call-with-output-file "setup.cfg"
(lambda (port) (lambda (port)
(format port "[directories]~% (format port "[directories]~%
basedirlist = ~a,~a~% basedirlist = ~a,~a~%
[rc_options]~% [rc_options]~%
backend = TkAgg~%" backend = TkAgg~%"
(assoc-ref inputs "tcl") (assoc-ref inputs "tcl")
(assoc-ref inputs "tk")))))) (assoc-ref inputs "tk")))))))
(alist-cons-after (add-after 'install 'install-doc
'install 'install-doc (lambda* (#:key inputs outputs #:allow-other-keys)
(lambda* (#:key inputs outputs #:allow-other-keys) (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
(let* ((data (string-append (assoc-ref outputs "doc") "/share")) (doc (string-append data "/doc/" ,name "-" ,version))
(doc (string-append data "/doc/" ,name "-" ,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
;; Make installed package available for building the ;; documentation
;; documentation (add-installed-pythonpath inputs outputs)
(add-installed-pythonpath inputs outputs) (with-directory-excursion "doc"
(with-directory-excursion "doc" ;; Produce pdf in 'A4' format.
;; Produce pdf in 'A4' format. (substitute* (find-files "." "conf\\.py")
(substitute* (find-files "." "conf\\.py") (("latex_paper_size = 'letter'")
(("latex_paper_size = 'letter'") "latex_paper_size = 'a4'"))
"latex_paper_size = 'a4'")) (mkdir-p html)
(mkdir-p html) (mkdir-p info)
(mkdir-p info) ;; The doc recommends to run the 'html' target twice.
;; The doc recommends to run the 'html' target twice. (system* "python" "make.py" "html")
(system* "python" "make.py" "html") (system* "python" "make.py" "html")
(system* "python" "make.py" "html") (copy-recursively "build/html" html)
(copy-recursively "build/html" html) (system* "python" "make.py" "latex")
(system* "python" "make.py" "latex") (system* "python" "make.py" "texinfo")
(system* "python" "make.py" "texinfo")
(symlink (string-append html "/_images")
(string-append info "/matplotlib-figures"))
(with-directory-excursion "build/texinfo"
(substitute* "matplotlib.texi"
(("@image\\{([^,]*)" all file)
(string-append "@image{matplotlib-figures/" file)))
(symlink (string-append html "/_images") (symlink (string-append html "/_images")
"./matplotlib-figures") (string-append info "/matplotlib-figures"))
(system* "makeinfo" "--no-split" (with-directory-excursion "build/texinfo"
"-o" "matplotlib.info" "matplotlib.texi")) (substitute* "matplotlib.texi"
(copy-file "build/texinfo/matplotlib.info" (("@image\\{([^,]*)" all file)
(string-append info "/matplotlib.info")) (string-append "@image{matplotlib-figures/" file)))
(copy-file "build/latex/Matplotlib.pdf" (symlink (string-append html "/_images")
(string-append doc "/Matplotlib.pdf"))))) "./matplotlib-figures")
%standard-phases)))) (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")))))))))
(home-page "http://matplotlib.org") (home-page "http://matplotlib.org")
(synopsis "2D plotting library for Python") (synopsis "2D plotting library for Python")
(description (description