pkg: allow path string as `#:scope' argument

This commit is contained in:
Matthew Flatt 2013-08-20 15:22:51 -06:00
parent 0ecd04787a
commit c0af1fe4bd
2 changed files with 9 additions and 2 deletions

View File

@ -21,9 +21,12 @@ building blocks and local-database support.
The @racketmodname[pkg] module provides a programmatic interface The @racketmodname[pkg] module provides a programmatic interface
to the @exec{raco pkg} sub-subcommands. to the @exec{raco pkg} sub-subcommands.
Each-long form option of the command-line interface is keyword Each-long form option of the command-line interface is a keyword
argument to the functions described below. An argument corresponding to @DFlag{type}, @DFlag{deps}, argument to the functions described below. An argument corresponding to @DFlag{type}, @DFlag{deps},
@DFlag{format}, or @DFlag{scope} accepts its argument as a symbol. All other options @DFlag{format}, or @DFlag{scope} accepts its argument as a symbol.
An argument corresponding to @DFlag{scope} is also allowed to be a path string,
as would be provided to @DFlag{scope-dir}.
Options without argument correspond to keyword arguments that
accept booleans, where @racket[#t] is equivalent to the presence of accept booleans, where @racket[#t] is equivalent to the presence of
the option. the option.

View File

@ -45,6 +45,10 @@
(cond (cond
[installation 'installation] [installation 'installation]
[user 'user] [user 'user]
[(path-string? given-scope)
;; This can happens when a #:scope value is given a path programmatically.
;; Make it easier on clients by alloing that.
(path->complete-path given-scope)]
[scope-dir (path->complete-path scope-dir)] [scope-dir (path->complete-path scope-dir)]
[else [else
(define default-scope (default-pkg-scope)) (define default-scope (default-pkg-scope))