Skip to content

Commit

Permalink
fix paths to stdlibs being put into test manifest again (#2259)
Browse files Browse the repository at this point in the history
* fix paths to stdlibs being put into test manifest again

(cherry picked from commit 42c0d64)
  • Loading branch information
KristofferC authored and staticfloat committed Jan 6, 2021
1 parent 4503bdf commit 1d83f1a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,9 @@ abspath!(ctx::Context, manifest::Dict{UUID,PackageEntry}) =
abspath!(dirname(ctx.env.project_file), manifest)
function abspath!(project::String, manifest::Dict{UUID,PackageEntry})
for (uuid, entry) in manifest
entry.path !== nothing || continue
entry.path = project_rel_path(project, entry.path)
if entry.path !== nothing
entry.path = project_rel_path(project, entry.path)
end
end
return manifest
end
Expand Down Expand Up @@ -1487,21 +1488,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
@error err
err isa Resolve.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 1d83f1a

Please sign in to comment.