From 1821c19adb5c70a18d876a119cc55273d38655aa Mon Sep 17 00:00:00 2001 From: "Tamas K. Papp" Date: Mon, 11 Nov 2019 09:10:09 +0100 Subject: [PATCH] Rewrite using example in BinaryProvider.jl. Specifically, use the recommended template https://github.com/JuliaPackaging/BinaryProvider.jl/blob/d57da3f92ad843ea8529a666ca4ea2151e9e0c64/test/LibFoo.jl/deps/build.jl --- Project.toml | 2 +- deps/build.jl | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Project.toml b/Project.toml index 0eeaf8c..ff60c4f 100644 --- a/Project.toml +++ b/Project.toml @@ -12,7 +12,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -BinaryProvider = "0.3.2, 0.4, 0.5" +BinaryProvider = "0.5" julia = "0.7, 1" [targets] diff --git a/deps/build.jl b/deps/build.jl index a8624b8..086e245 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -27,20 +27,20 @@ download_info = Dict( Windows(:x86_64) => ("$bin_prefix/libRmath.x86_64-w64-mingw32.tar.gz", "12929d34ec0fd3e29c0633410c08396b21989513fcd4d28ed845c3cabf316a19"), ) -# Install unsatisfied or updated dependencies: -unsatisfied = any(!satisfied(p; verbose=verbose) for p in products) -if haskey(download_info, platform_key()) - url, tarball_hash = download_info[platform_key()] - if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix) +# First, check to see if we're all satisfied +if any(!satisfied(p; verbose=verbose) for p in products) + try # Download and install binaries - install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose) + url, tarball_hash = choose_download(download_info) + install(url, tarball_hash; prefix=prefix, force=true, verbose=true) + catch e + if typeof(e) <: ArgumentError + error("Your platform $(Sys.MACHINE) is not supported by this package!") + else + rethrow(e) + end end -elseif unsatisfied - # If we don't have a BinaryProvider-compatible .tar.gz to download, complain. - # Alternatively, you could attempt to install from a separate provider, - # build from source or something even more ambitious here. - error("Your platform $(triplet(platform_key())) is not supported by this package!") -end -# Write out a deps.jl file that will contain mappings for our products -write_deps_file(joinpath(@__DIR__, "deps.jl"), products) + # Finally, write out a deps.jl file + write_deps_file(joinpath(@__DIR__, "deps.jl"), products) +end