pkg/lib: add #:versions? argument to extract-pkg-dependencies

This commit is contained in:
Matthew Flatt 2014-05-02 10:18:14 -06:00
parent ee64a15265
commit 33547d554a
2 changed files with 19 additions and 7 deletions

View File

@ -437,7 +437,8 @@ The results are as follows:
@defproc[(extract-pkg-dependencies [info (symbol? (-> any/c) . -> . any/c)]
[#:build-deps? build-deps? boolean? #f]
[#:filter? filter? boolean? #f])
[#:filter? filter? boolean? #f]
[#:versions? versions? boolean? #f])
(listof (or/c string? (cons/c string? list?)))]{
Returns packages dependencies reported by the @racket[info] procedure
@ -449,7 +450,12 @@ run-time dependencies and build-time dependencies.
If @racket[filter?] is true, then platform-specific dependencies are
removed from the result list when they do not apply to the current
platform, and other information is stripped so that the result list is
always a list of strings.}
always a list of either strings (when @racket[versions?] is true) or a
two-element list containing a string and a version (when
@racket[versions?] is @racket[#f]).
@history[#:changed "6.0.1.6" @elem{Added the @racket[#:versions?] argument.}]}
@defproc[(pkg-directory->module-paths [dir path-string?]
[pkg-name string]

View File

@ -2916,7 +2916,8 @@
(define (extract-pkg-dependencies get-info
#:build-deps? [build-deps? #t]
#:filter? [filter? #f])
#:filter? [filter? #f]
#:versions? [versions? #f])
(define v (if get-info
(get-info 'deps (lambda () empty))
empty))
@ -2929,9 +2930,13 @@
(if filter?
(for/list ([dep (in-list all-v)]
#:when (dependency-this-platform? dep))
(if (pair? dep)
(car dep)
dep))
(define name
(if (pair? dep)
(car dep)
dep))
(if versions?
(list name (dependency->version dep))
name))
all-v))
(define (get-pkg-content desc
@ -3262,7 +3267,8 @@
[extract-pkg-dependencies
(->* ((symbol? (-> any/c) . -> . any/c))
(#:build-deps? boolean?
#:filter? boolean?)
#:filter? boolean?
#:versions? boolean?)
(listof (or/c string? (cons/c string? list?))))]
[pkg-single-collection
(->* (path-string?)