Skip to content

Commit cfbb3c7

Browse files
authored
Merge pull request #37653 from giordano/mg/libgfortran
[BinaryPlatforms] Do not cache host platform
2 parents 00c2d45 + 54ed72a commit cfbb3c7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

base/binaryplatforms.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,6 @@ function host_triplet()
10041004
return str
10051005
end
10061006

1007-
# Cache the host platform value, and return it if someone asks for just `HostPlatform()`.
1008-
default_host_platform = HostPlatform(parse(Platform, host_triplet()))
10091007
"""
10101008
HostPlatform()
10111009
@@ -1015,7 +1013,7 @@ relevant comparison strategies set to host platform mode. This is equivalent to
10151013
HostPlatform(parse(Platform, Base.BinaryPlatforms.host_triplet()))
10161014
"""
10171015
function HostPlatform()
1018-
return default_host_platform::Platform
1016+
return HostPlatform(parse(Platform, host_triplet()))::Platform
10191017
end
10201018

10211019
"""

test/binaryplatforms.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ end
112112
# Now test libgfortran/cxxstring ABIs
113113
@test triplet(P("x86_64", "linux"; libgfortran_version=v"3", cxxstring_abi="cxx11")) == "x86_64-linux-gnu-libgfortran3-cxx11"
114114
@test triplet(P("armv7l", "linux"; libc="musl", cxxstring_abi="cxx03")) == "armv7l-linux-musleabihf-cxx03"
115+
if !isnothing(detect_libgfortran_version())
116+
# When `libgfortran` can be detected at runtime, make sure
117+
# `HostPlatform` has the appropriate key.
118+
@test tags(HostPlatform())["libgfortran_version"] == string(detect_libgfortran_version())
119+
end
115120

116121
# Test tags()
117122
t = tags(P("x86_64", "linux"))

0 commit comments

Comments
 (0)