From 7aef1f044f3483e8b07d33fb4cfe918be554de69 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Mon, 5 Aug 2024 15:50:35 -0400 Subject: [PATCH] Download progress fixes. Show compressed registry add confirmation. (#3979) * set progressbar to nothing for efficiency Downloads.jl shortcuts if progress == nothing * don't show glitchy progress during header download * add missing compressed registry add confirmation --- src/PlatformEngines.jl | 8 ++++++-- src/Registry/Registry.jl | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PlatformEngines.jl b/src/PlatformEngines.jl index 1acffb2d4e..f3f405ced9 100644 --- a/src/PlatformEngines.jl +++ b/src/PlatformEngines.jl @@ -275,11 +275,15 @@ function download( (total, now) -> begin bar.max = total bar.current = now - show_progress(io, bar) + # Downloads.download attatches the progress indicator to the header request too + # which is only ~100 bytes, and will report as 0 - 100% progress immediately + # then dip down to 0 before the actual download starts. So we only show the + # progress bar once the real download starts. + total > 1000 && show_progress(io, bar) end end else - (total, now) -> nothing + nothing end try Downloads.download(url, dest; headers, progress) diff --git a/src/Registry/Registry.jl b/src/Registry/Registry.jl index de1977eef0..8d5137daba 100644 --- a/src/Registry/Registry.jl +++ b/src/Registry/Registry.jl @@ -206,6 +206,7 @@ function download_registries(io::IO, regs::Vector{RegistrySpec}, depot::String=d open(joinpath(regdir, reg.name * ".toml"), "w") do io TOML.print(io, reg_info) end + printpkgstyle(io, :Added, "`$(reg.name)` registry to $(Base.contractuser(regdir))") else mktempdir() do tmp if reg.path !== nothing && reg.linked == true # symlink to local source