Skip to content

Commit

Permalink
other fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Dec 3, 2020
1 parent 2d7bb80 commit ae6c094
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,7 @@ end

function abspath!(env::EnvCache, manifest::Dict{UUID,PackageEntry})
for (uuid, entry) in manifest
if is_stdlib(uuid)
entry.path = Types.stdlib_path(entry.name)
elseif entry.path !== nothing
if entry.path !== nothing
entry.path = project_rel_path(env, entry.path)
end
end
Expand Down Expand Up @@ -1428,22 +1426,33 @@ function sandbox(fn::Function, ctx::Context, target::PackageSpec, target_path::S
end
end
end

Types.write_manifest(working_manifest, tmp_manifest)
# sandbox
with_temp_env(tmp) do
temp_ctx = Context()
temp_ctx.env.project.deps[target.name] = target.uuid
write_env(temp_ctx.env, update_undo = false)

try
Pkg.resolve(; io=devnull)
Pkg.resolve(temp_ctx; io=devnull)
@debug "Using _parent_ dep graph"
catch err# TODO
err isa ResolverError || rethrow()
@debug err
@warn "Could not use exact versions of packages in manifest, re-resolving"
temp_ctx.env.manifest = Dict(uuid => entry for (uuid, entry) in temp_ctx.env.manifest if isfixed(entry))
Pkg.resolve(temp_ctx; io=devnull)
@debug "Using _clean_ dep graph"
end

# Absolutify stdlibs paths
for (uuid, entry) in temp_ctx.env.manifest
if is_stdlib(uuid)
entry.path = Types.stdlib_path(entry.name)
end
end
write_env(temp_ctx.env, update_undo = false)

# Run sandboxed code
path_sep = Sys.iswindows() ? ';' : ':'
withenv(fn, "JULIA_LOAD_PATH" => "@$(path_sep)$(tmp)", "JULIA_PROJECT" => nothing)
Expand Down

0 comments on commit ae6c094

Please sign in to comment.