summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-07 23:57:36 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-08 00:03:38 +0200
commit4a4cbd0bdd2ad8c4f37c3ffdd69596ef1ef41d91 (patch)
treed4b840d7212bbb498e9f3428d65b48ab2f8be96d
parent84da4ad4b073e472f1fff747a9fb1952f55e05f9 (diff)
downloadguix-4a4cbd0bdd2ad8c4f37c3ffdd69596ef1ef41d91.tar.gz
gexp: 'gexp->script' returns a script that can easily be compiled.
* guix/gexp.scm (gexp->script): Produce an 'eval-when' form around
  assignments of %load-path and %load-compiled-path.
-rw-r--r--guix/gexp.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 5401cbf96f..ff80e305db 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -496,14 +496,16 @@ its search path."
                            (format port
                                    "#!~a/bin/guile --no-auto-compile~%!#~%"
                                    (ungexp guile))
+
+                           ;; Write the 'eval-when' form so that it can be
+                           ;; compiled.
                            (write
-                            '(set! %load-path
-                                   (cons (ungexp modules) %load-path))
-                            port)
-                           (write
-                            '(set! %load-compiled-path
-                                   (cons (ungexp compiled)
-                                         %load-compiled-path))
+                            '(eval-when (expand load eval)
+                               (set! %load-path
+                                    (cons (ungexp modules) %load-path))
+                               (set! %load-compiled-path
+                                     (cons (ungexp compiled)
+                                           %load-compiled-path)))
                             port)
                            (write '(ungexp exp) port)
                            (chmod port #o555)))))))