guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Sun, 8 Apr 2018 19:01:23 -0400 (EDT)

branch: master
commit ce405612043810f74b2823d1efff898d020eb6d4
Author: Ludovic Courtès <address@hidden>
Date:   Mon Apr 9 01:00:11 2018 +0200

    evaluate: Change directory to SOURCE.
    
    * bin/evaluate.in (with-directory-excursion): Remove.
    (main): chdir to SOURCE.
---
 bin/evaluate.in | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/bin/evaluate.in b/bin/evaluate.in
index 3d5bbb6..985b787 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -35,17 +35,6 @@ exec ${GUILE:address@hidden@} --no-auto-compile -e main -s 
"$0" "$@"
   (let ((m (resolve-interface module)))
     (module-ref m name)))
 
-(define-syntax-rule (with-directory-excursion dir body ...)
-  "Run BODY with DIR as the process's current directory."
-  (let ((init (getcwd)))
-   (dynamic-wind
-     (lambda ()
-       (chdir dir))
-     (lambda ()
-       body ...)
-     (lambda ()
-       (chdir init)))))
-
 (define %not-colon
   (char-set-complement (char-set #\:)))
 
@@ -66,18 +55,22 @@ exec ${GUILE:address@hidden@} --no-auto-compile -e main -s 
"$0" "$@"
        (unless (string-null? guix-package-path)
          (setenv "GUIX_PACKAGE_PATH" guix-package-path))
 
+       ;; Since we have relative file name canonicalization by default, better
+       ;; change to SOURCE to make sure things like 'include' with relative
+       ;; file names work as expected.
+       (chdir source)
+
        (save-module-excursion
         (lambda ()
           (set-current-module %user-module)
-          (with-directory-excursion source
-            (let ((original-path %load-path))
-              (dynamic-wind
-                (lambda ()
-                  (set! %load-path (append load-path original-path)))
-                (lambda ()
-                  (primitive-load (assq-ref spec #:file)))
-                (lambda ()
-                  (set! %load-path original-path)))))))
+          (let ((original-path %load-path))
+            (dynamic-wind
+              (lambda ()
+                (set! %load-path (append load-path original-path)))
+              (lambda ()
+                (primitive-load (assq-ref spec #:file)))
+              (lambda ()
+                (set! %load-path original-path))))))
 
        ;; From there on we can access Guix modules.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]