From d7620388ac012492b0daa7ccb19b3ca0edf356c3 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Fri, 19 May 2017 20:19:37 -0700 Subject: [PATCH] Use isbindingresolved when checking imported packages (#21580) --- base/pkg/entry.jl | 2 +- test/pkg.jl | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 945953859d2b2..82bb1f5ab2fb9 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -541,7 +541,7 @@ function resolve( info("$(up)grading $pkg: v$ver1 => v$ver2") Write.update(pkg, Read.sha1(pkg,ver2)) pkgsym = Symbol(pkg) - if isdefined(Main, pkgsym) && isa(getfield(Main, pkgsym), Module) + if Base.isbindingresolved(Main, pkgsym) && isa(getfield(Main, pkgsym), Module) push!(imported, "- $pkg") end end diff --git a/test/pkg.jl b/test/pkg.jl index 9e81abeedd5e9..670d1dbcc42aa 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -489,6 +489,16 @@ temp_pkg_dir() do @test isempty(Pkg.dependents("Example")) @test isempty(Pkg.dependents("Example.jl")) + @test_warn s -> !contains(s, "updated but were already imported") begin + Pkg.add("Iterators") + Pkg.update("Iterators") + end + + # Do it again, because the above Iterators test will update things prematurely + LibGit2.with(LibGit2.GitRepo, metadata_dir) do repo + LibGit2.reset!(repo, LibGit2.GitHash(old_commit), LibGit2.Consts.RESET_HARD) + end + @test_warn ("INFO: Installing Colors v0.6.4", "INFO: Installing ColorTypes v0.2.2", "INFO: Installing FixedPointNumbers v0.1.3",