6.9 API for Reading "info.rkt" Files
(require setup/getinfo) | package: base |
procedure
(get-info collection-names [ #:namespace namespace #:bootstrap? bootstrap?])
→
(or/c ((symbol?) ((-> any)) . ->* . any) #f) collection-names : (listof string?) namespace : (or/c namespace? #f) = #f bootstrap? : any/c = #f
procedure
(get-info/full path [ #:namespace namespace #:bootstrap? bootstrap?])
→
(or/c ((symbol?) ((-> any)) . ->* . any) #f) path : path-string? namespace : (or/c namespace? #f) = #f bootstrap? : any/c = #f
The get-info/full function returns #f if there is no "info.rkt" (or "info.ss") file in the directory. If there is a "info.rkt" (or "info.ss") file that has the wrong shape (i.e., not a module using info or setup/infotab), or if the "info.rkt" file fails to load, then an exception is raised. If the "info.rkt" file loaded, get-info/full returns the info procedure. If the "info.rkt" file does not exist, then get-info/full does the same checks for the "info.ss" file, either raising an exception or returning the info procedure from the "info.ss" file.
The "info.rkt" (or "info.ss") module is loaded into namespace if it is not #f, or a private, weakly-held namespace otherwise.
If bootstrap? is true, then use-compiled-file-paths is set to '() while reading "info.rkt" (or "info.ss"), in case an existing compiled file is broken. Furthermore, the info and setup/infotab modules are attached to namespace from the namespace of get-info/full before attempting to load "info.rkt" (or "info.ss").
As the module is loaded, the environment variable set is pruned to contain only environment variables that are listed in the PLT_INFO_ALLOW_VARS environment variable, which contains a ;-separated list of names. By default, the list of allowed variable names is empty.
Changed in version 6.5.0.2 of package base: Added environment-variable pruning and PLT_INFO_ALLOW_VARS support.
procedure
(find-relevant-directories syms [mode]) → (listof path?)
syms : (listof symbol?)
mode : (or/c 'preferred 'all-available 'no-planet 'no-user) = 'preferred
Note that the cache may be out of date by the time you call get-info/full, so do not assume that every returned directory’s "info.rkt" file will supply one of the requested symbols.
The result is in a canonical order (sorted lexicographically by directory name), and the paths it returns are suitable for providing to get-info/full.
If mode is specified, it must be either
'preferred (the default), 'all-available,
'no-planet, or 'no-user. If mode is
'all-available, find-relevant-directories returns
all installed directories whose info files contain the specified
symbols—
Regardless of mode, note that find-relevant-directories will not consider package-level "info.rkt" files for multi-collection packages, since those files are not part of any collection or PLaneT package. In contrast, a single-collection package’s "info.rkt" file is part of a collection, and thus will be considered.
Collection links from the installation-wide collection links file or packages with installation scope are cached with the installation’s main "lib" directory, and links from the user-specific collection links file and packages are cached with the user-specific directory (build-path (find-system-path 'addon-dir) "collects") for all-version cases, and in (build-path (find-system-path 'addon-dir) (version) "collects") for version-specific cases. These cache paths can be redirected by an 'info-domain-root entry in "config.rktd" (see Installation Configuration and Search Paths).
procedure
(find-relevant-directory-records syms key)
→ (listof directory-record?) syms : (listof symbol?) key : (or/c 'preferred 'all-available 'no-planet 'no-user)
struct
(struct directory-record (maj min spec path syms) #:extra-constructor-name make-directory-record) maj : integer? min : integer? spec : any/c path : path? syms : (listof symbol?)
procedure