From 6035db418f23a800184b1a1e6d3973705376832e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 15 Aug 2013 14:19:55 -0600 Subject: [PATCH] pkg/lib: add `pkg-directory->module-paths' --- pkgs/racket-pkgs/racket-doc/pkg/scribblings/lib.scrbl | 9 +++++++++ racket/collects/pkg/lib.rkt | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-pkgs/racket-doc/pkg/scribblings/lib.scrbl b/pkgs/racket-pkgs/racket-doc/pkg/scribblings/lib.scrbl index 503bc6dbe5..10408ccff1 100644 --- a/pkgs/racket-pkgs/racket-doc/pkg/scribblings/lib.scrbl +++ b/pkgs/racket-pkgs/racket-doc/pkg/scribblings/lib.scrbl @@ -405,3 +405,12 @@ 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.} + +@defproc[(pkg-directory->module-paths [dir path-string?] + [pkg-name string] + [#:namespace namespace namespace? (make-base-namespace)]) + (listof module-path?)]{ + +Returns a list of module paths (normalized in the sense of +@racket[collapse-module-path]) that are provided by the package +represented by @racket[dir] and named @racket[pkg-name].} diff --git a/racket/collects/pkg/lib.rkt b/racket/collects/pkg/lib.rkt index b8e5f65049..0b077ce05a 100644 --- a/racket/collects/pkg/lib.rkt +++ b/racket/collects/pkg/lib.rkt @@ -2300,6 +2300,10 @@ (when clean? (delete-directory/files dir)))) +(define (pkg-directory->module-paths dir pkg-name + #:namespace [metadata-ns (make-metadata-namespace)]) + (set->list (directory->module-paths dir pkg-name metadata-ns))) + (define (directory->module-paths dir pkg-name metadata-ns) (define dummy (build-path dir "dummy.rkt")) (define compiled (string->path-element "compiled")) @@ -2595,4 +2599,8 @@ (or/c #f string?))] [find-pkg-installation-scope (->* (string?) (#:next? boolean?) - (or/c #f package-scope/c))])) + (or/c #f package-scope/c))] + [pkg-directory->module-paths (->* (path-string? string?) + (#:namespace namespace?) + (listof module-path?))])) +