From 83cbe5fc73fddd8134fa8d42b699249dc3383701 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 2 Dec 2020 02:00:17 -0800 Subject: [PATCH] Work around precompiling packages with no `version` entry (#2251) While experimenting with non-precompiled stdlibs, I found that a `Project.toml` that has no `version` entry set will cause `precompile()` to fail in a nasty way. (cherry picked from commit f9307f81faef5c9b8babc44996d5dfd7470a0144) --- src/API.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/API.jl b/src/API.jl index c2f177697f..c0906ed9a6 100644 --- a/src/API.jl +++ b/src/API.jl @@ -948,7 +948,10 @@ function precompile(ctx::Context; internal_call::Bool=false, kwargs...) was_recompiled[pkgid] = false if haskey(man, pkgid.uuid) pkgent = man[pkgid.uuid] - push!(pkg_specs, PackageSpec(uuid = pkgid.uuid, name = pkgent.name, version = pkgent.version, tree_hash = pkgent.tree_hash)) + # If we have an unusual situation such as an un-versioned package (like an stdlib that + # is being overridden) its `version` may be `nothing`. + pkgver = something(pkgent.version, VersionSpec()) + push!(pkg_specs, PackageSpec(uuid = pkgid.uuid, name = pkgent.name, version = pkgver, tree_hash = pkgent.tree_hash)) end end precomp_prune_suspended!(pkg_specs)