Skip to content

Commit e559d5b

Browse files
authored
Revert "Use upstream functionality for fixing stdlib paths (#136)"
This reverts commit 4a51dbf.
1 parent 5cbf2e8 commit e559d5b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/utils.jl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,28 @@ function maybe_fix_path(file)
359359
file = normpath(newfile)
360360
end
361361
end
362-
return Base.fixup_stdlib_path(file)
362+
return maybe_fixup_stdlib_path(file)
363+
end
364+
365+
safe_isfile(x) = try isfile(x); catch; false end
366+
const BUILDBOT_STDLIB_PATH = dirname(abspath(String((@which uuid1()).file), "..", "..", ".."))
367+
replace_buildbot_stdlibpath(str::String) = replace(str, BUILDBOT_STDLIB_PATH => Sys.STDLIB)
368+
"""
369+
path = maybe_fixup_stdlib_path(path::String)
370+
371+
Return `path` corrected for julia issue [#26314](https://github.com/JuliaLang/julia/issues/26314) if applicable.
372+
Otherwise, return the input `path` unchanged.
373+
374+
Due to the issue mentioned above, location info for methods defined one of Julia's standard libraries
375+
are, for non source Julia builds, given as absolute paths on the worker that built the `julia` executable.
376+
This function corrects such a path to instead refer to the local path on the users drive.
377+
"""
378+
function maybe_fixup_stdlib_path(path)
379+
if !safe_isfile(path)
380+
maybe_stdlib_path = replace_buildbot_stdlibpath(path)
381+
safe_isfile(maybe_stdlib_path) && return maybe_stdlib_path
382+
end
383+
return path
363384
end
364385

365386
function postpath(filename, pre)

0 commit comments

Comments
 (0)