From 6985335faaa23965887b62ce8123f8f12e352bd5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Mar 2016 14:58:59 +0100 Subject: derivations: Add 'module->source-file-name'. * guix/derivations.scm (module->source-file-name): New procedure. (%imported-modules): Use it. * guix/gexp.scm (imported-modules): Likewise. --- guix/derivations.scm | 11 ++++++++--- guix/gexp.scm | 4 +--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/guix/derivations.scm b/guix/derivations.scm index f24e3c6f92..2af65b1dc0 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -91,6 +91,7 @@ (define-module (guix derivations) built-derivations + module->source-file-name build-expression->derivation) ;; Re-export it from here for backward compatibility. @@ -1040,6 +1041,12 @@ (define search-path* ;; up looking for the same files over and over again. (memoize search-path)) +(define (module->source-file-name module) + "Return the file name corresponding to MODULE, a Guile module name (a list +of symbols.)" + (string-append (string-join (map symbol->string module) "/") + ".scm")) + (define* (%imported-modules store modules ;deprecated #:key (name "module-import") (system (%current-system)) @@ -1051,9 +1058,7 @@ (define* (%imported-modules store modules ;deprecated ;; TODO: Determine the closure of MODULES, build the `.go' files, ;; canonicalize the source files through read/write, etc. (let ((files (map (lambda (m) - (let ((f (string-append - (string-join (map symbol->string m) "/") - ".scm"))) + (let ((f (module->source-file-name m))) (cons f (search-path* module-path f)))) modules))) (imported-files store files #:name name #:system system diff --git a/guix/gexp.scm b/guix/gexp.scm index 7cbc79c31c..c408c94c43 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -918,9 +918,7 @@ (define* (imported-modules modules ;; TODO: Determine the closure of MODULES, build the `.go' files, ;; canonicalize the source files through read/write, etc. (let ((files (map (lambda (m) - (let ((f (string-append - (string-join (map symbol->string m) "/") - ".scm"))) + (let ((f (module->source-file-name m))) (cons f (search-path* module-path f)))) modules))) (imported-files files #:name name #:system system -- cgit v1.2.3