gexp: Move 'current-source-directory' to (guix utils).
authorLudovic Courtès <ludo@gnu.org>
Wed, 15 Jun 2016 21:08:05 +0000 (23:08 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 16 Jun 2016 07:34:32 +0000 (09:34 +0200)
* guix/gexp.scm (extract-directory, current-source-directory): Move to...
* guix/utils.scm (extract-directory, current-source-directory):
... here.  New procedures.

guix/gexp.scm
guix/utils.scm

index b4d737e..8e604ff 100644 (file)
@@ -202,19 +202,6 @@ cross-compiling.)"
   ;; %%LOCAL-FILE is not.
   (%%local-file file promise name recursive?))
 
-(define (extract-directory properties)
-  "Extract the directory name from source location PROPERTIES."
-  (match (assq 'filename properties)
-    (('filename . (? string? file-name))
-     (dirname file-name))
-    (_
-     #f)))
-
-(define-syntax-rule (current-source-directory)
-  "Expand to the directory of the current source file or #f if it could not
-be determined."
-  (extract-directory (current-source-location)))
-
 (define (absolute-file-name file directory)
   "Return the canonical absolute file name for FILE, which lives in the
 vicinity of DIRECTORY."
index 2d8bfd8..19fd0b0 100644 (file)
@@ -53,6 +53,8 @@
             substitute-keyword-arguments
             ensure-keyword-arguments
 
+            current-source-directory
+
             <location>
             location
             location?
@@ -700,6 +702,19 @@ output port, and PROC's result is returned."
 ;;; Source location.
 ;;;
 
+(define (extract-directory properties)
+  "Extract the directory name from source location PROPERTIES."
+  (match (assq 'filename properties)
+    (('filename . (? string? file-name))
+     (dirname file-name))
+    (_
+     #f)))
+
+(define-syntax-rule (current-source-directory)
+  "Expand to the directory of the current source file or #f if it could not
+be determined."
+  (extract-directory (current-source-location)))
+
 ;; A source location.
 (define-record-type <location>
   (make-location file line column)