summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-08 23:06:19 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-08 23:06:19 +0200
commit2e1bafb03438757c7cc34c16230b00623507ff84 (patch)
tree2f09766293395c67de7858d93a777c863e8ba20f /guix
parent9c814b828ae07899594ad9cd83d2e77e4cc528cc (diff)
downloadguix-patches-2e1bafb03438757c7cc34c16230b00623507ff84.tar
guix-patches-2e1bafb03438757c7cc34c16230b00623507ff84.tar.gz
packages: Gracefully print packages whose 'location' is #f.
* guix/packages.scm (<package> printer): Check whether LOC is #f. * tests/packages.scm ("printer with location", "printer without location"): New tests.
Diffstat (limited to 'guix')
-rw-r--r--guix/packages.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index 76e01f3f12..b397a24678 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -229,11 +229,14 @@ corresponds to the arguments expected by `set-path-environment-variable'."
(lambda (package port)
(let ((loc (package-location package))
(format simple-format))
- (format port "#<package ~a-~a ~a:~a ~a>"
+ (format port "#<package ~a-~a ~a~a>"
(package-name package)
(package-version package)
- (location-file loc)
- (location-line loc)
+ (if loc
+ (format #f "~a:~a "
+ (location-file loc)
+ (location-line loc))
+ "")
(number->string (object-address
package)
16)))))