From d57c34d26b8b5a7d17a5b8811742c5f291567209 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 21 Jul 2021 11:48:07 +0200 Subject: [PATCH] gnu: Add python-bash-kernel. * gnu/packages/jupyter.scm (python-bash-kernel): New variable. --- gnu/packages/jupyter.scm | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/gnu/packages/jupyter.scm b/gnu/packages/jupyter.scm index 2fb0b0375a..ede22363c3 100644 --- a/gnu/packages/jupyter.scm +++ b/gnu/packages/jupyter.scm @@ -25,6 +25,7 @@ (define-module (gnu packages jupyter) #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system python) + #:use-module (gnu packages bash) #:use-module (gnu packages check) #:use-module (gnu packages cpp) #:use-module (gnu packages linux) @@ -382,3 +383,43 @@ (define-public repo2docker image of the repository, or as a means of building images that are pushed to a Docker registry.") (license license:bsd-3))) + +(define-public python-bash-kernel + (package + (name "python-bash-kernel") + (version "0.7.2") + (source (origin + (method url-fetch) + (uri (pypi-uri "bash_kernel" version)) + (sha256 + (base32 + "0w0nbr3iqqsgpk83rgd0f5b02462bkyj2n0h6i9dwyc1vpnq9350")))) + (build-system python-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'bash-references + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "bash_kernel/kernel.py" + (("\"bash\"") + (string-append "\"" (assoc-ref inputs "bash") "/bin/bash\"")) + (("\\['bash', ") + (string-append "['" (assoc-ref inputs "bash") "/bin/bash', "))) + #t)) + (add-after 'install 'install-kernelspec + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (setenv "HOME" "/tmp") + (invoke "python" "-m" "bash_kernel.install" "--prefix" out) + #t)))))) + (inputs + `(("bash" ,bash))) + (propagated-inputs + `(("python-pexpect" ,python-pexpect) + ("python-ipykernel" ,python-ipykernel) + ("python-jupyter-client" ,python-jupyter-client))) + (home-page "https://github.com/takluyver/bash_kernel") + (synopsis "Jupyter kernel for Bash") + (description "A bash shell kernel for Jupyter.") + (license license:expat)))