mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-12 14:16:55 -05:00
packages: Add a printer for <package>.
* guix/packages.scm (<package>): Add record printer.
This commit is contained in:
parent
aaa848f3af
commit
946b72c924
1 changed files with 14 additions and 0 deletions
|
@ -23,6 +23,7 @@ (define-module (guix packages)
|
|||
#:use-module (ice-9 match)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-9 gnu)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:export (location
|
||||
|
@ -164,6 +165,19 @@ (define-record-type* <package>
|
|||
(default (and=> (current-source-location)
|
||||
source-properties->location))))
|
||||
|
||||
(set-record-type-printer! <package>
|
||||
(lambda (package port)
|
||||
(let ((loc (package-location package))
|
||||
(format simple-format))
|
||||
(format port "#<package ~a-~a ~a:~a ~a>"
|
||||
(package-name package)
|
||||
(package-version package)
|
||||
(location-file loc)
|
||||
(location-line loc)
|
||||
(number->string (object-address
|
||||
package)
|
||||
16)))))
|
||||
|
||||
|
||||
;; Error conditions.
|
||||
|
||||
|
|
Loading…
Reference in a new issue