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

update path to Compiler stdlib to a valid one similar to how it is done for other stdlibs #57274

Merged
merged 2 commits into from
Feb 12, 2025
Merged
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: 9 additions & 5 deletions base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ function fixup_stdlib_path(path::String)
# The file defining Base.Sys gets included after this file is included so make sure
# this function is valid even in this intermediary state
if isdefined(@__MODULE__, :Sys)
BUILD_STDLIB_PATH = Sys.BUILD_STDLIB_PATH::String
STDLIB = Sys.STDLIB::String
if BUILD_STDLIB_PATH != STDLIB
if Sys.BUILD_STDLIB_PATH != Sys.STDLIB
# BUILD_STDLIB_PATH gets defined in sysinfo.jl
npath = normpath(path)
npath′ = replace(npath, normpath(BUILD_STDLIB_PATH) => normpath(STDLIB))
return npath == npath′ ? path : npath′
npath′ = replace(npath, normpath(Sys.BUILD_STDLIB_PATH) => normpath(Sys.STDLIB))
path = npath == npath′ ? path : npath′
end
if isdefined(@__MODULE__, :Core) && isdefined(Core, :Compiler)
compiler_folder = dirname(String(Base.moduleloc(Core.Compiler).file))
if dirname(path) == compiler_folder
return abspath(Sys.STDLIB, "..", "..", "Compiler", "src", basename(path))
end
end
end
return path
Expand Down
4 changes: 4 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ file, ln = functionloc(versioninfo, Tuple{})
@test isfile(pathof(InteractiveUtils))
@test isdir(pkgdir(InteractiveUtils))

# compiler stdlib path updating
file, ln = functionloc(Core.Compiler.tmeet, Tuple{Int, Float64})
@test isfile(file)

@testset "buildbot path updating" begin
file, ln = functionloc(versioninfo, Tuple{})
@test isfile(file)
Expand Down