Skip to content

Commit 046bec3

Browse files
author
Will Kimmerer
authored
Switch back to Downloads.jl (#130)
* Switch back to Downloads.jl * Update ArchiveUtils.jl * Update ArchiveUtils.jl * Change to request error
1 parent dd83f8b commit 046bec3

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/ArchiveUtils.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,10 @@ function download_verify(url, hash, path)
134134
return true
135135
else
136136
mkpath(dirname(path))
137-
# `curl` doesn't automatically overwrite an existing file, delete it
138-
# before attempting the download.
139-
rm(path; force=true)
140137
@info "Downloading $(url) to $(path)..."
141-
# Temporarily shell out to `curl` to download, until `Downloads` bugs are squashed
142-
try
143-
run(`curl -C - -s -\# -f -L $(url) -o $(path)`)
144-
catch e
145-
# Downloads throws an ErrorException, so we'll do the same
146-
error("download failed: $(e)")
147-
end
138+
139+
rm(path; force=true)
140+
Downloads.download(url, path)
148141
verify(path, hash) || error("Verification failed")
149142
end
150143
end

test/compat.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Test
22
using BinaryBuilderBase: extract_kwargs, extract_fields, strip_backslash, ArchiveSource
3-
3+
using Downloads: RequestError
44
@testset "Compat functions" begin
55
foo(; kwargs...) = collect(extract_kwargs(kwargs, (:bar, :qux)))
66
@test foo(; a = 1) == Pair[]
@@ -43,7 +43,7 @@ using BinaryBuilderBase: download_verify, list_tarball_files
4343
# Test that a 404 throws
4444
url = "https://github.com/not_a_file"
4545
dest = joinpath(dir, "blah")
46-
@test_logs (:info, "Downloading $(url) to $(dest)...") @test_throws ErrorException download_verify(url, "0"^64, dest)
46+
@test_logs (:info, "Downloading $(url) to $(dest)...") @test_throws RequestError download_verify(url, "0"^64, dest)
4747

4848
# Test that a bad hash logs a message and fails
4949
url = "https://github.com/staticfloat/small_bin/raw/master/socrates.tar.xz"

0 commit comments

Comments
 (0)