Skip to content

Commit

Permalink
Merge pull request #403 from JuliaReach/schillic/requires
Browse files Browse the repository at this point in the history
Fix depwarnings of Requires in Julia v0.7
  • Loading branch information
schillic authored Jul 31, 2018
2 parents 841ba5f + 102a748 commit d846c47
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/Approximations/overapproximate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ function overapproximate(X::LazySet{N},
return H
end

@require IntervalArithmetic begin

"""
overapproximate(::LazySet{N}, ::Type{LazySets.Interval}) where {N<:Real}
Expand All @@ -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
7 changes: 4 additions & 3 deletions src/HPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,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,
Expand Down Expand Up @@ -368,5 +369,5 @@ function vertices_list(P::HPolytope{N};
prunefunc(P)
return collect(points(P))
end

end
end # quote
end # function load_polyhedra_hpolytope()
5 changes: 5 additions & 0 deletions src/LazySets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ include("Approximations/Approximations.jl")
# ============
include("plot_recipes.jl")

# ===================================================
# Load external packages on-demand (using 'Requires')
# ===================================================
include("init.jl")

end # module
6 changes: 4 additions & 2 deletions src/VPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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,
Expand Down Expand Up @@ -223,4 +224,5 @@ function cartesian_product(P1::VPolytope, P2::VPolytope; backend=CDDLib.CDDLibra
return VPolytope(Pcp)
end

end
end # quote
end # function load_polyhedra_vpolytope()
8 changes: 8 additions & 0 deletions src/init.jl
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d846c47

Please sign in to comment.