Skip to content

Commit 54d45e0

Browse files
authored
Work around buggy Base.pkgversion again. (#594)
1 parent 39beabb commit 54d45e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/GPUCompiler.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,18 @@ _precompile_()
5353

5454

5555
compile_cache = "" # defined in __init__()
56-
const pkgver = @static VERSION > v"1.9" ? Base.pkgversion(GPUCompiler) : ""
57-
56+
const pkgver = @static VERSION > v"1.9" ? Base.pkgversion(GPUCompiler) : nothing
5857

5958
function __init__()
6059
STDERR_HAS_COLOR[] = get(stderr, :color, false)
6160

6261
dir = @get_scratch!("compiled")
6362
## add the Julia version
6463
dir = joinpath(dir, "v$(VERSION.major).$(VERSION.minor)")
65-
if VERSION > v"1.9"
66-
## also add the package version
64+
## also add the package version
65+
if pkgver !== nothing
66+
# XXX: `Base.pkgversion` is buggy and sometimes returns `nothing`, see e.g.
67+
# JuliaLang/PackageCompiler.jl#896 and JuliaGPU/GPUCompiler.jl#593
6768
dir = joinpath(dir, "v$(pkgver.major).$(pkgver.minor)")
6869
end
6970
mkpath(dir)

0 commit comments

Comments
 (0)