From a1694e52b6e534cf7f9656f4013bc5b5d06ecee5 Mon Sep 17 00:00:00 2001 From: KristofferC Date: Mon, 28 Aug 2023 15:24:40 +0200 Subject: [PATCH] tweak how Pkg is loaded for precompiling when testing --- src/Operations.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Operations.jl b/src/Operations.jl index 652b004af9..d3d93a9a30 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -1653,10 +1653,13 @@ end function gen_test_precompile_code(source_path::String; coverage, julia_args::Cmd, test_args::Cmd) # Note that we cannot load the dev-ed Pkg here during Pkg testing # so the `Pkg.precompile` that is run here is the one in the sysimage + pkgdir = joinpath(@__DIR__, "..") code = """ - Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")) - $(Base.load_path_setup_code(false)) - append!(empty!(ARGS), $(repr(test_args.exec))) + pushfirst!(LOAD_PATH, $(repr(pkgdir))) + try using Pkg + catch e + @warn "Pkg not loaded, skipping precompilation." + end Pkg.precompile(warn_loaded = false) """ return gen_subprocess_cmd(code, source_path; coverage, julia_args)