diff --git a/PlotsBase/src/PlotsBase.jl b/PlotsBase/src/PlotsBase.jl index 6a12a4346..b4def57bd 100644 --- a/PlotsBase/src/PlotsBase.jl +++ b/PlotsBase/src/PlotsBase.jl @@ -7,6 +7,16 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@max_m @eval Base.Experimental.@max_methods 1 end +# multiple weakdeps triggers (keep in sync with Project.toml !) +const WEAKDEPS = Expr( + :block, + :(import UnitfulLatexify), + :(import LaTeXStrings), + :(import Latexify), + :(import Contour), + :(import Colors), +) + using Base.Meta import PrecompileTools diff --git a/PlotsBase/src/backends.jl b/PlotsBase/src/backends.jl index c94d56aa8..613dceb86 100644 --- a/PlotsBase/src/backends.jl +++ b/PlotsBase/src/backends.jl @@ -15,6 +15,8 @@ for sym ∈ _default_supported_syms end end +const WEAKDEPS = + _display(::Plot{NoneBackend}) = @warn "No backend activated yet. Load the backend library and call the activation function to do so.\nE.g. `import GR; gr()` activates the GR backend." diff --git a/PlotsBase/test/runtests.jl b/PlotsBase/test/runtests.jl index 2c11677be..5646fdfe5 100644 --- a/PlotsBase/test/runtests.jl +++ b/PlotsBase/test/runtests.jl @@ -14,17 +14,7 @@ const TEST_BACKENDS = NamedTuple(p => Symbol(lowercase(string(p))) for p ∈ TES get!(ENV, "MPLBACKEND", "agg") using PlotsBase - -# multiple weakdeps (keep in sync with Project.toml !) -const WEAKDEPS = Expr( - :block, - :(import UnitfulLatexify), - :(import LaTeXStrings), - :(import Latexify), - :(import Contour), - :(import Colors), -) -eval(WEAKDEPS) +eval(PlotsBase.WEAKDEPS) # initialize all backends for pkg ∈ TEST_PACKAGES diff --git a/PlotsBase/test/test_preferences.jl b/PlotsBase/test/test_preferences.jl index 59402941a..e439bf9e7 100644 --- a/PlotsBase/test/test_preferences.jl +++ b/PlotsBase/test/test_preferences.jl @@ -72,7 +72,7 @@ end write( script, """ - $WEAKDEPS + $(PlotsBase.WEAKDEPS) import $pkg using Test, PlotsBase diff --git a/docs/make.jl b/docs/make.jl index cba4ed89b..1eadcd14f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -23,6 +23,7 @@ import UnicodePlots import StatsPlots const PlotsBase = Plots.PlotsBase +eval(PlotsBase.WEAKDEPS) const SRC_DIR = joinpath(@__DIR__, "src") const WORK_DIR = joinpath(@__DIR__, "work")