Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add WEAKDEPS to trigger package extensions #5026

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions PlotsBase/src/PlotsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions PlotsBase/src/backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
12 changes: 1 addition & 11 deletions PlotsBase/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/test/test_preferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ end
write(
script,
"""
$WEAKDEPS
$(PlotsBase.WEAKDEPS)

import $pkg
using Test, PlotsBase
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading