Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent code loading from lookin in the versioned environment when bu…
Browse files Browse the repository at this point in the history
…ilding Julia
KristofferC committed Sep 27, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b6a748f commit 107ba07
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
@@ -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)
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
4 changes: 2 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
@@ -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")

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

0 comments on commit 107ba07

Please sign in to comment.