Skip to content

Commit 41c5519

Browse files
KristofferCtopolarity
authored andcommitted
fix lookup when extension is in [deps]
1 parent 70825b8 commit 41c5519

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

base/loading.jl

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -827,14 +827,14 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St
827827
entry = entry::Dict{String, Any}
828828
uuid = get(entry, "uuid", nothing)::Union{String, Nothing}
829829
uuid === nothing && continue
830+
# deps is either a list of names (deps = ["DepA", "DepB"]) or
831+
# a table of entries (deps = {"DepA" = "6ea...", "DepB" = "55d..."}
832+
deps = get(entry, "deps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing}
830833
if UUID(uuid) === where.uuid
831834
found_where = true
832-
# deps is either a list of names (deps = ["DepA", "DepB"]) or
833-
# a table of entries (deps = {"DepA" = "6ea...", "DepB" = "55d..."}
834-
deps = get(entry, "deps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing}
835835
if deps isa Vector{String}
836836
found_name = name in deps
837-
break
837+
found_name && @goto done
838838
elseif deps isa Dict{String, Any}
839839
deps = deps::Dict{String, Any}
840840
for (dep, uuid) in deps
@@ -853,30 +853,33 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St
853853
return PkgId(UUID(uuid), name)
854854
end
855855
exts = extensions[where.name]::Union{String, Vector{String}}
856+
weakdeps = get(entry, "weakdeps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing}
856857
if (exts isa String && name == exts) || (exts isa Vector{String} && name in exts)
857-
weakdeps = get(entry, "weakdeps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing}
858-
if weakdeps !== nothing
859-
if weakdeps isa Vector{String}
860-
found_name = name in weakdeps
861-
break
862-
elseif weakdeps isa Dict{String, Any}
863-
weakdeps = weakdeps::Dict{String, Any}
864-
for (dep, uuid) in weakdeps
865-
uuid::String
866-
if dep === name
867-
return PkgId(UUID(uuid), name)
858+
for deps′ in [weakdeps, deps]
859+
if deps′ !== nothing
860+
if deps′ isa Vector{String}
861+
found_name = name in deps′
862+
found_name && @goto done
863+
elseif deps′ isa Dict{String, Any}
864+
deps′ = deps′::Dict{String, Any}
865+
for (dep, uuid) in deps′
866+
uuid::String
867+
if dep === name
868+
return PkgId(UUID(uuid), name)
869+
end
870+
end
868871
end
869872
end
870873
end
871874
end
872-
end
873875
# `name` is not an ext, do standard lookup as if this was the parent
874876
return identify_package(PkgId(UUID(uuid), dep_name), name)
875877
end
876878
end
877879
end
878880
end
879881
end
882+
@label done
880883
found_where || return nothing
881884
found_name || return PkgId(name)
882885
# Only reach here if deps was not a dict which mean we have a unique name for the dep

0 commit comments

Comments
 (0)