GNU bug report logs -
#22629
Towards a new 'guix pull'
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Thu, 11 Feb 2016 10:36:02 UTC
Severity: important
Merged with 28471
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* guix/self.scm (scheme-modules*): Move to...
* guix/discovery.scm (scheme-modules*): ... here. New procedure. Make
'sub-directory' an optional parameter.
---
guix/discovery.scm | 13 ++++++++++++-
guix/self.scm | 7 -------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 2b627d108..3fc6e2c9e 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo <at> gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +27,7 @@
#:use-module (ice-9 ftw)
#:export (scheme-files
scheme-modules
+ scheme-modules*
fold-modules
all-modules
fold-module-public-variables))
@@ -115,6 +116,16 @@ name and the exception key and arguments."
(string-append directory "/" sub-directory)
directory))))
+(define* (scheme-modules* directory #:optional sub-directory)
+ "Return the list of module names found under SUB-DIRECTORY in DIRECTORY.
+This is a source-only variant that does not try to load files."
+ (let ((prefix (string-length directory)))
+ (map (lambda (file)
+ (file-name->module-name (string-drop file prefix)))
+ (scheme-files (if sub-directory
+ (string-append directory "/" sub-directory)
+ directory)))))
+
(define* (fold-modules proc init path #:key (warn (const #f)))
"Fold over all the Scheme modules present in PATH, a list of directories.
Call (PROC MODULE RESULT) for each module that is found."
diff --git a/guix/self.scm b/guix/self.scm
index 90649db17..81f9b0cfd 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -206,13 +206,6 @@ list of file-name/file-like objects suitable as inputs to 'imported-files'."
(local-file file #:recursive? #t)))
(find-files (string-append directory "/" sub-directory) pred)))
-(define (scheme-modules* directory sub-directory)
- "Return the list of module names found under SUB-DIRECTORY in DIRECTORY."
- (let ((prefix (string-length directory)))
- (map (lambda (file)
- (file-name->module-name (string-drop file prefix)))
- (scheme-files (string-append directory "/" sub-directory)))))
-
(define* (sub-directory item sub-directory)
"Return SUB-DIRECTORY within ITEM, which may be a file name or a file-like
object."
--
2.18.0
This bug report was last modified 6 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.