Skip to content

Commit ecaba50

Browse files
authored
Use tryparse to parse platform triplet (#74)
This makes parsing more robust against unknown platforms, e.g. for architectures introduced in later versions of Julia than the currently running one.
1 parent da95c37 commit ecaba50

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JLLWrappers"
22
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
33
authors = ["Mosè Giordano", "Elliot Saba"]
4-
version = "1.6.1"
4+
version = "1.7.0"
55

66
[deps]
77
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

src/toplevel_generators.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ function generate_wrapper_load(src_name, pkg_uuid, __source__)
110110
@static if VERSION < v"1.6.0-DEV"
111111
return :(parse_wrapper_platform(x) = platform_key_abi(x))
112112
else
113-
return :(parse_wrapper_platform(x) = parse(Platform, x))
113+
# Use `tryparse` because the `Artifacts.toml` file cound include artifacts for
114+
# platforms/architectures not yet supported by the current version of Julia.
115+
return :(parse_wrapper_platform(x) = tryparse(Platform, x))
114116
end
115117
end
116118

@@ -142,7 +144,12 @@ function generate_wrapper_load(src_name, pkg_uuid, __source__)
142144
# package-specific Generator-closures
143145
d = Dict{Platform,String}()
144146
for f in x
145-
d[parse_wrapper_platform(basename(f)[1:end-3])] = joinpath(dir, "wrappers", f)
147+
platform = parse_wrapper_platform(basename(f)[1:end-3])
148+
# `platform` could be `nothing` for example if the architecture isn't
149+
# known to currently running Julia version.
150+
if !isnothing(platform)
151+
d[platform] = joinpath(dir, "wrappers", f)
152+
end
146153
end
147154
return d
148155
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if VERSION <= v"1.6.0-DEV"
1818
]
1919
else
2020
test_pkgs = [
21-
("HelloWorldC", v"1.3.0+0"),
21+
("HelloWorldC", v"1.4.0+0"),
2222
("LAMMPS", v"2.4.0+0"),
2323
("libxls", v"1.6.2+0"),
2424
("Vulkan_Headers", v"1.3.243+1"),

0 commit comments

Comments
 (0)