Skip to content

Commit

Permalink
Fix clima_artifact for Julia 1.12
Browse files Browse the repository at this point in the history
JuliaLang/julia@e95eedd
changed some internal types in `_artifact_str`, so that
`@clima_artifact` stopped working. This fixes it

Closes #117
  • Loading branch information
Sbozzolo committed Oct 25, 2024
1 parent 58270c9 commit 31e654b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ClimaUtilities.jl Release Notes
===============================

main
------

### Bug fixes

- Fixed `@clima_artifact` for Julia 1.12. PR [#123](https://github.com/CliMA/ClimaUtilities.jl/pull/123)

v0.1.17
------

Expand Down
20 changes: 16 additions & 4 deletions src/ClimaArtifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ macro clima_artifact(name, context = nothing)
# If artifact_name is not a string (e.g., it is a variable), we have to do all the
# work at runtime
return quote
if VERSION >= v"1.12.0-DEV.1163"
local LazyArtifacts = Val($(lazyartifacts))
else
local LazyArtifacts = $(lazyartifacts)
end

local platform = $(esc(platform))
local artifact_name, artifact_path_tail, hash =
JuliaArtifacts.artifact_slash_lookup(
Expand All @@ -126,7 +132,7 @@ macro clima_artifact(name, context = nothing)
$(artifact_dict),
$(hash),
$(platform),
$(lazyartifacts),
LazyArtifacts,
)::String
end
push!(ACCESSED_ARTIFACTS, artifact_name)
Expand All @@ -139,13 +145,19 @@ macro clima_artifact(name, context = nothing)
$(artifact_dict),
$(hash),
$(platform),
$(lazyartifacts),
LazyArtifacts,
)::String
end
else
# If artifact_name is not a string (e.g., it is a variable), we have to do all the
# work at runtime
return quote
if VERSION >= v"1.12.0-DEV.1163"
local LazyArtifacts = Val($(lazyartifacts))
else
local LazyArtifacts = $(lazyartifacts)
end

local platform = $(esc(platform))
local artifact_name, artifact_path_tail, hash =
JuliaArtifacts.artifact_slash_lookup(
Expand Down Expand Up @@ -179,7 +191,7 @@ macro clima_artifact(name, context = nothing)
$(artifact_dict),
hash,
platform,
$(lazyartifacts),
LazyArtifacts,
)::String
end
push!(ACCESSED_ARTIFACTS, artifact_name)
Expand All @@ -193,7 +205,7 @@ macro clima_artifact(name, context = nothing)
$(artifact_dict),
hash,
platform,
$(lazyartifacts),
LazyArtifacts,
)::String
end
end
Expand Down

0 comments on commit 31e654b

Please sign in to comment.