Skip to content

Commit

Permalink
Merge pull request #3706 from JuliaLang/backports-release-1.10
Browse files Browse the repository at this point in the history
Backports release 1.10
  • Loading branch information
KristofferC authored Nov 27, 2023
2 parents e63c601 + 5e5c6c4 commit 563a338
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ p7zip_jll = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
HistoricalStdlibVersions = "1.2"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
HistoricalStdlibVersions = "6df8b67a-e8a0-4029-b4b7-ac196fe72102"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Preferences", "HistoricalStdlibVersions"]
4 changes: 1 addition & 3 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1481,10 +1481,8 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool
queued = precomp_queued(pkgspec)

circular = pkg in circular_deps
# skip stale checking and force compilation if any dep was recompiled in this session
any_dep_recompiled = any(map(dep->was_recompiled[dep], deps))
is_stale = true
if !circular && (queued || any_dep_recompiled || (!suspended && (is_stale = !Base.isprecompiled(pkg; ignore_loaded=true, stale_cache, cachepaths, sourcepath))))
if !circular && (queued || (!suspended && (is_stale = !Base.isprecompiled(pkg; ignore_loaded=true, stale_cache, cachepaths, sourcepath))))
Base.acquire(parallel_limiter)
is_direct_dep = pkg in direct_deps

Expand Down
4 changes: 4 additions & 0 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,12 @@ function gen_build_code(build_file::String; inherit_project::Bool = false)
cd($(repr(dirname(build_file))))
include($(repr(build_file)))
"""
# This will make it so that running Pkg.build runs the build in a session with --startup=no
# *unless* the parent julia session is started with --startup=yes explicitly.
startup_flag = Base.JLOptions().startupfile == 1 ? "yes" : "no"
return ```
$(Base.julia_cmd()) -O0 --color=no --history-file=no
--startup-file=$startup_flag
$(inherit_project ? `--project=$(Base.active_project())` : ``)
--eval $code
```
Expand Down
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ Logging.with_logger(hide_logs ? Logging.NullLogger() : Logging.current_logger())
end
end

@showtime Base.Filesystem.temp_cleanup_purge(force=true)
if haskey(ENV, "CI")
# if CI don't clean up as it will be slower than the runner filesystem reset
empty!(Base.Filesystem.TEMP_CLEANUP)
else
@showtime Base.Filesystem.temp_cleanup_purge(force=true)
end

end # module

Expand Down
40 changes: 23 additions & 17 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function isolate(fn::Function; loaded_depot=false, linked_reg=true)
loaded_depot && push!(DEPOT_PATH, LOADED_DEPOT)
fn()
finally
if target_depot !== nothing && isdir(target_depot)
if !haskey(ENV, "CI") && target_depot !== nothing && isdir(target_depot)
try
Base.rm(target_depot; force=true, recursive=true)
catch err
Expand Down Expand Up @@ -148,12 +148,14 @@ function temp_pkg_dir(fn::Function;rm=true, linked_reg=true)
push!(DEPOT_PATH, depot_dir)
fn(env_dir)
finally
try
rm && Base.rm(env_dir; force=true, recursive=true)
rm && Base.rm(depot_dir; force=true, recursive=true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
if rm && !haskey(ENV, "CI")
try
Base.rm(env_dir; force=true, recursive=true)
Base.rm(depot_dir; force=true, recursive=true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
end
end
end
end
Expand All @@ -175,11 +177,13 @@ function cd_tempdir(f; rm=true)
cd(tmp) do
f(tmp)
end
try
rm && Base.rm(tmp; force = true, recursive = true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
if rm && !haskey(ENV, "CI")
try
Base.rm(tmp; force = true, recursive = true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
end
end
end

Expand Down Expand Up @@ -212,11 +216,13 @@ function with_temp_env(f, env_name::AbstractString="Dummy"; rm=true)
applicable(f, env_path) ? f(env_path) : f()
finally
Base.ACTIVE_PROJECT[] = prev_active
try
rm && Base.rm(env_path; force = true, recursive = true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
if rm && !haskey(ENV, "CI")
try
Base.rm(env_path; force = true, recursive = true)
catch err
# Avoid raising an exception here as it will mask the original exception
println(stderr_f(), "Exception in finally: $(sprint(showerror, err))")
end
end
end
end
Expand Down

0 comments on commit 563a338

Please sign in to comment.