Try to avoid adding Setup non-globally
This commit is contained in:
parent
e2af89fef1
commit
1f5136ae4c
15
src/Setup.jl
15
src/Setup.jl
|
@ -46,13 +46,16 @@ function ensureglobalpkg(pkg::String)
|
||||||
if isnothing(Base.find_package(pkg))
|
if isnothing(Base.find_package(pkg))
|
||||||
Pkg = lazypkg()
|
Pkg = lazypkg()
|
||||||
oldproj = Base.current_project()
|
oldproj = Base.current_project()
|
||||||
Pkg.activate()
|
try
|
||||||
@info "Installing $pkg"
|
|
||||||
lazypkg().add(pkg)
|
|
||||||
if isnothing(oldproj)
|
|
||||||
Pkg.activate()
|
Pkg.activate()
|
||||||
else
|
@info "Installing $pkg"
|
||||||
Pkg.activate(oldproj)
|
Pkg.add(pkg)
|
||||||
|
finally
|
||||||
|
if isnothing(oldproj)
|
||||||
|
Pkg.activate()
|
||||||
|
else
|
||||||
|
Pkg.activate(oldproj)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,18 @@ else
|
||||||
catch e
|
catch e
|
||||||
if e isa ArgumentError && isnothing(Base.find_package("Setup")) # Package not found in current path
|
if e isa ArgumentError && isnothing(Base.find_package("Setup")) # Package not found in current path
|
||||||
let pkg_id = Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")
|
let pkg_id = Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")
|
||||||
Base.require(pkg_id).develop(path=joinpath(@__DIR__, "Setup"))
|
Pkg = Base.require(pkg_id)
|
||||||
|
cproj = Base.current_project()
|
||||||
|
try
|
||||||
|
Pkg.activate()
|
||||||
|
Pkg.develop(path=joinpath(@__DIR__, "Setup"))
|
||||||
|
finally
|
||||||
|
if isnothing(cproj)
|
||||||
|
Pkg.activate()
|
||||||
|
else
|
||||||
|
Pkg.activate(cproj)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
using Setup
|
using Setup
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue