From 0d6172126f19854f1d6d082f5861dbdb6a88c843 Mon Sep 17 00:00:00 2001 From: schillic Date: Tue, 24 Jul 2018 22:30:14 +0200 Subject: [PATCH 1/2] fix depwarnings of Requires in Julia v0.7 --- src/HPolytope.jl | 7 ++++--- src/LazySets.jl | 5 +++++ src/VPolytope.jl | 6 ++++-- src/init.jl | 8 ++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 src/init.jl diff --git a/src/HPolytope.jl b/src/HPolytope.jl index 02d4335a1a..34231d623f 100644 --- a/src/HPolytope.jl +++ b/src/HPolytope.jl @@ -201,7 +201,8 @@ function tosimplehrep(P::HPolytope{N}) where {N} return (A, b) end -@require Polyhedra begin +function load_polyhedra_hpolytope() # function to be loaded by Requires +return quote using CDDLib # default backend import Polyhedra:polyhedron, SimpleHRepresentation, SimpleHRepresentation, @@ -347,5 +348,5 @@ function vertices_list(P::HPolytope{N}; prunefunc(P) return [vi for vi in vreps(P)] end - -end +end # quote +end # function load_polyhedra_hpolytope() diff --git a/src/LazySets.jl b/src/LazySets.jl index 95fe4464c3..b67a77f571 100644 --- a/src/LazySets.jl +++ b/src/LazySets.jl @@ -85,4 +85,9 @@ include("Approximations/Approximations.jl") # ============ include("plot_recipes.jl") +# =================================================== +# Load external packages on-demand (using 'Requires') +# =================================================== +include("init.jl") + end # module diff --git a/src/VPolytope.jl b/src/VPolytope.jl index fd72be7b31..b5728573a6 100644 --- a/src/VPolytope.jl +++ b/src/VPolytope.jl @@ -103,7 +103,8 @@ function vertices_list(P::VPolytope{N})::Vector{Vector{N}} where {N<:Real} end -@require Polyhedra begin +function load_polyhedra_vpolytope() # function to be loaded by Requires +return quote using CDDLib # default backend import Polyhedra:polyhedron, SimpleHRepresentation, SimpleVRepresentation, @@ -222,4 +223,5 @@ function cartesian_product(P1::VPolytope, P2::VPolytope; backend=CDDLib.CDDLibra return VPolytope(Pcp) end -end +end # quote +end # function load_polyhedra_vpolytope() diff --git a/src/init.jl b/src/init.jl new file mode 100644 index 0000000000..7a441fb929 --- /dev/null +++ b/src/init.jl @@ -0,0 +1,8 @@ +function __init__() + @require Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" load_polyhedra() +end + +function load_polyhedra() + eval(load_polyhedra_hpolytope()) + eval(load_polyhedra_vpolytope()) +end From 102a748b9fd753296a717a895f84336d4739dc96 Mon Sep 17 00:00:00 2001 From: schillic Date: Tue, 24 Jul 2018 22:32:19 +0200 Subject: [PATCH 2/2] remove redundant @require --- src/Approximations/overapproximate.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Approximations/overapproximate.jl b/src/Approximations/overapproximate.jl index 311b4f3269..b3fbe70ff9 100644 --- a/src/Approximations/overapproximate.jl +++ b/src/Approximations/overapproximate.jl @@ -146,8 +146,6 @@ function overapproximate(X::LazySet{N}, return H end -@require IntervalArithmetic begin - """ overapproximate(::LazySet{N}, ::Type{LazySets.Interval}) where {N<:Real} @@ -168,5 +166,3 @@ function overapproximate(S::LazySet{N}, ::Type{LazySets.Interval}) where {N<:Rea hi = σ([one(N)], S)[1] return LazySets.Interval(lo, hi) end - -end # @require