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.
This commit is contained in:
Ludovic Courtès 2014-09-07 23:57:36 +02:00
parent 84da4ad4b0
commit 4a4cbd0bdd
1 changed files with 9 additions and 7 deletions

View File

@ -496,14 +496,16 @@ its search path."
(format port (format port
"#!~a/bin/guile --no-auto-compile~%!#~%" "#!~a/bin/guile --no-auto-compile~%!#~%"
(ungexp guile)) (ungexp guile))
;; Write the 'eval-when' form so that it can be
;; compiled.
(write (write
'(set! %load-path '(eval-when (expand load eval)
(cons (ungexp modules) %load-path)) (set! %load-path
port) (cons (ungexp modules) %load-path))
(write (set! %load-compiled-path
'(set! %load-compiled-path (cons (ungexp compiled)
(cons (ungexp compiled) %load-compiled-path)))
%load-compiled-path))
port) port)
(write '(ungexp exp) port) (write '(ungexp exp) port)
(chmod port #o555))))))) (chmod port #o555)))))))