[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/08: discovery: Hide Guile warnings when loading modules.
From: |
guix-commits |
Subject: |
02/08: discovery: Hide Guile warnings when loading modules. |
Date: |
Thu, 30 Sep 2021 17:45:39 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit bedcba8f5cb6ab861d5379795fdb3698841c14b9
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Sep 30 10:16:02 2021 +0200
discovery: Hide Guile warnings when loading modules.
Fixes <https://issues.guix.gnu.org/43747>.
* guix/discovery.scm (scheme-modules): Parameterize 'current-warning-port'.
---
guix/discovery.scm | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/guix/discovery.scm b/guix/discovery.scm
index b84b9ff..81d4ca6 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -107,19 +107,25 @@ name and the exception key and arguments."
(define prefix-len
(string-length directory))
- (filter-map (lambda (file)
- (let* ((relative (string-drop file prefix-len))
- (module (file-name->module-name relative)))
- (catch #t
- (lambda ()
- (resolve-interface module))
- (lambda args
- ;; Report the error, but keep going.
- (warn file module args)
- #f))))
- (scheme-files (if sub-directory
- (string-append directory "/" sub-directory)
- directory))))
+ ;; Hide Guile warnings such as "source file [...] newer than compiled" when
+ ;; loading user code, unless we're hacking on Guix proper. See
+ ;; <https://issues.guix.gnu.org/43747>.
+ (parameterize ((current-warning-port (if (getenv "GUIX_UNINSTALLED")
+ (current-warning-port)
+ (%make-void-port "w"))))
+ (filter-map (lambda (file)
+ (let* ((relative (string-drop file prefix-len))
+ (module (file-name->module-name relative)))
+ (catch #t
+ (lambda ()
+ (resolve-interface module))
+ (lambda args
+ ;; Report the error, but keep going.
+ (warn file module args)
+ #f))))
+ (scheme-files (if sub-directory
+ (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.
- branch master updated (56b1070 -> 88d26e1), guix-commits, 2021/09/30
- 03/08: gnu: grokmirror: Update to 2.0.11., guix-commits, 2021/09/30
- 01/08: packages: Factorize and document 'computed-origin-method'., guix-commits, 2021/09/30
- 02/08: discovery: Hide Guile warnings when loading modules.,
guix-commits <=
- 04/08: gnu: Remove python2-passlib., guix-commits, 2021/09/30
- 05/08: gnu: python-passlib: Use python-bcrypt., guix-commits, 2021/09/30
- 07/08: import: pypi: Honor the 'upstream-name' package property., guix-commits, 2021/09/30
- 06/08: gnu: Remove python-py-bcrypt., guix-commits, 2021/09/30
- 08/08: gnu: av-98: Set 'upstream-name' property., guix-commits, 2021/09/30