Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent code loading from lookin in the versioned environment when building Julia #51479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,33 @@ See also [`JULIA_DEPOT_PATH`](@ref JULIA_DEPOT_PATH), and
"""
const DEPOT_PATH = String[]

function append_default_depot_path!(DEPOT_PATH)
path = joinpath(homedir(), ".julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
function append_default_depot_path!(DEPOT_PATH; only_bundled::Bool=false)
if !only_bundled
path = joinpath(homedir(), ".julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
end
path = abspath(Sys.BINDIR, "..", "local", "share", "julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
path = abspath(Sys.BINDIR, "..", "share", "julia")
path in DEPOT_PATH || push!(DEPOT_PATH, path)
return DEPOT_PATH
end

function init_depot_path()
function init_depot_path(; only_bundled::Bool=false)
empty!(DEPOT_PATH)
if haskey(ENV, "JULIA_DEPOT_PATH")
str = ENV["JULIA_DEPOT_PATH"]
isempty(str) && return
for path in eachsplit(str, Sys.iswindows() ? ';' : ':')
if isempty(path)
append_default_depot_path!(DEPOT_PATH)
append_default_depot_path!(DEPOT_PATH; only_bundled)
else
path = expanduser(path)
path in DEPOT_PATH || push!(DEPOT_PATH, path)
end
end
else
append_default_depot_path!(DEPOT_PATH)
append_default_depot_path!(DEPOT_PATH; only_bundled)
end
nothing
end
Expand Down
4 changes: 2 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Base.MainInclude: eval, include
pushfirst!(Base._included_files, (@__MODULE__, abspath(@__FILE__)))

# set up depot & load paths to be able to find stdlib packages
Base.init_depot_path()
Base.init_load_path()
Base.init_depot_path(; only_bundled=true)
push!(empty!(LOAD_PATH), "@stdlib")
Comment on lines +15 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be append_default_depot_path!(DEPOT_PATH; only_bundled=true)? It seems odd for one of these to now respect the user's JULIA_DEPOT_PATH, but for the other to ignore the user's LOAD_PATH. In theory our sysimg.mk file sets both of those variables correctly for the build already (although I think someone pointed out recently that I missed a place)


if Base.is_primary_base_module
# load some stdlib packages but don't put their names in Main
Expand Down