Subject: [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.

From: [email-masked] (Ludovic Courtès)
Date: Thu, 17 May 2018 11:42:35 +0200

Rouby Pierre-Antoine <[email-masked]> skribis:

> * gnu/package/guile.scm (jupyter-guile-kernel): New variable.

Applied with the changes below, to avoid propagated inputs.

Thanks!

Ludo’.

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index a4a0f87c0..84f46d1cc 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages maths)
@@ -2253,8 +2254,6 @@ messaging library.")
                   (kernel-file "kernel.json")
                   (guild  (string-append (assoc-ref %build-inputs "guile")
                                          "/bin/guild"))
-                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
-                                         "/lib"))
                   (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
                   (json   (assoc-ref %build-inputs "guile-json"))
                   (deps   (list g-szmq json))
@@ -2270,18 +2269,26 @@ messaging library.")
                                      "/site-ccache/")
                                 deps)
                            ":")))
-           
+
              ;; Make installation directories.
              (mkdir-p module-dir)
              (mkdir-p kernel-dir)
              (mkdir-p go-dir)
 
+             ;; Make a writable copy of SOURCE.
+             (copy-recursively source ".")
+
+             ;; Record the absolute file name of the 'openssl' command.
+             (substitute* "hmac.scm"
+               (("openssl")
+                (string-append (assoc-ref %build-inputs "openssl")
+                               "/bin/openssl")))
+
              ;; Compile .scm files and install.
-             (chdir source)
              (setenv "GUILE_AUTO_COMPILE" "0")
              (setenv "GUILE_LOAD_PATH" path)
              (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
-           
+
              (for-each (lambda (file)
                          (let* ((dest-file (string-append module-dir "/"
                                                           file))
@@ -2291,7 +2298,7 @@ messaging library.")
                                                            base ".go")))))
                            ;; Install source module.
                            (copy-file file dest-file)
-                         
+
                            ;; Install compiled module.
                            (unless (zero? (system* guild "compile"
                                                    "-L" source
@@ -2300,7 +2307,7 @@ messaging library.")
                              (error (format #f "Failed to compile ~s to ~s!"
                                             file go-file)))))
                        scm-files)
-             
+
              ;; Install kernel
              (copy-file kernel-file (string-append kernel-dir "/"
                                                    kernel-file))
@@ -2308,19 +2315,20 @@ messaging library.")
              (substitute* (string-append kernel-dir "/"
                                          kernel-file)
                (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
-                (string-append module-dir "/guile-jupyter-kernel.scm")))
-             (substitute* (string-append kernel-dir "/"
-                                         kernel-file)
+                (string-append module-dir "/guile-jupyter-kernel.scm"))
+               (("\"guile\"")
+                (string-append "\"" (assoc-ref %build-inputs "guile")
+                               "/bin/guile\""))
                (("-s")
                 (string-append "--no-auto-compile\", \"-s")))
+
              #t))))
       (inputs
-       `(("zeromq" ,zeromq)))
+       `(("openssl" ,openssl)
+         ("guile" ,guile-2.2)))
       (propagated-inputs
        `(("guile-json" ,guile-json)
-         ("guile-simple-zmq" ,guile-simple-zmq)
-         ("guile" ,guile-2.2)
-         ("openssl" ,openssl)))
+         ("guile-simple-zmq" ,guile-simple-zmq)))
       (synopsis "Guile kernel for the Jupyter Notebook")
       (description
        "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It