Skip to content

Commit

Permalink
[loading] Search in Sys.STDLIB if name/uuid is known. (JuliaLang#39572)
Browse files Browse the repository at this point in the history
Locating a package with known uuid means the uuid was either
found in a manifest in LOAD_PATH or a "package folder" in LOAD_PATH.
However, looking up the package entrypoint fails for stdlibs that
are not in the sysimage, even if they have been explicitly added
to project/manifest by the user. This patch allows looking in
Sys.STDLIB after stdlibs, fixes JuliaLang#39504.
  • Loading branch information
fredrikekre authored Feb 9, 2021
1 parent 8f60d5c commit 5d7e13f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ function locate_package(pkg::PkgId)::Union{Nothing,String}
path = manifest_uuid_path(env, pkg)
path === nothing || return entry_path(path, pkg.name)
end
# Allow loading of stdlibs if the name/uuid are given
# e.g. if they have been explicitly added to the project/manifest
path = manifest_uuid_path(Sys.STDLIB::String, pkg)
path === nothing || return entry_path(path, pkg.name)
end
return nothing
end
Expand Down
1 change: 1 addition & 0 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
end
let v = readchomperrors(`$exename -i -e '
empty!(LOAD_PATH)
@eval Sys STDLIB=mktempdir()
Base.unreference_module(Base.PkgId(Base.UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils"))
'`)
# simulate not having a working version of InteractiveUtils,
Expand Down

0 comments on commit 5d7e13f

Please sign in to comment.