From ae6c094339e1b898179ef1e600181abdeb24e7f7 Mon Sep 17 00:00:00 2001 From: KristofferC Date: Thu, 3 Dec 2020 12:38:56 +0100 Subject: [PATCH] other fix --- src/Operations.jl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index 84f1f93719..e1d46cf6e0 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -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 @@ -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)