Skip to content

Commit

Permalink
Project.toml: increment version (0.9.9), upgrade CEnum, add Downloads.jl
Browse files Browse the repository at this point in the history
This migrates from `Base.download` to `Downloads.download`.
  • Loading branch information
PMeira committed Oct 30, 2024
1 parent 828ff0d commit 637fbcd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name = "OpenDSSDirect"
uuid = "a8b11937-1041-50f2-9818-136bb7a8fb06"
authors = ["Tom Short <[email protected]>"]
version = "0.9.8"
version = "0.9.9"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
CEnum = "^0.4"
CEnum = "0.4, 0.5"
DocStringExtensions = "^0.9"
Downloads = "^1"
julia = "^1"

[extras]
Expand Down
12 changes: 7 additions & 5 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Downloads

abstract type AbstractOS end
abstract type Unix <: AbstractOS end
abstract type BSD <: Unix end
Expand All @@ -18,7 +20,7 @@ function download(::Type{MacOS})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_darwin_$(DSS_CAPI_ARCH).tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "dss_capi.tar.gz"))
Base.download(url, filename)
Downloads.download(url, filename)

directory = normpath(@__DIR__)
run(`tar -xvf $filename -C $directory`)
Expand All @@ -42,7 +44,7 @@ function download(::Type{Linux})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_linux_$(DSS_CAPI_ARCH).tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "dss_capi.tar.gz"))
Base.download(url, filename)
Downloads.download(url, filename)

directory = normpath(@__DIR__)
run(`tar -xvf $filename -C $directory`)
Expand All @@ -60,7 +62,7 @@ function download_messages(::Union{Type{Linux}, Type{MacOS}})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/messages.tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "messages.tar.gz"))
Base.download(url, filename)
Downloads.download(url, filename)

directory = normpath(@__DIR__)
run(`tar -xvf $filename -C $directory`)
Expand All @@ -79,7 +81,7 @@ function download(::Type{Windows})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_win_$(BIT).zip"
@show url
filename = normpath(joinpath(@__DIR__, "dss_capi.zip"))
Base.download(url, filename)
Downloads.download(url, filename)

directory = normpath(@__DIR__)
mkpath(directory)
Expand Down Expand Up @@ -109,7 +111,7 @@ function download_messages(::Type{Windows})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/messages.zip"
@show url
filename = normpath(joinpath(@__DIR__, "messages.zip"))
Base.download(url, filename)
Downloads.download(url, filename)

directory = normpath(@__DIR__)

Expand Down
5 changes: 3 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Utils

using ..OpenDSSDirect
using Downloads

export get_string
export get_string_array
Expand Down Expand Up @@ -403,12 +404,12 @@ Defaults to the "examples" folder in the OpenDSSDirect package.
Returns the downloaded folder name.
"""
function Base.download(::Type{Examples}, folder::AbstractString=joinpath(@__DIR__, "../examples"); force::Bool=false)
function Downloads.download(::Type{Examples}, folder::AbstractString=joinpath(@__DIR__, "../examples"); force::Bool=false)
directory = abspath(normpath(folder))
electricdss_tst_master_folder = joinpath(directory, "electricdss-tst-master")
if force || !isdir(electricdss_tst_master_folder)
url = "https://github.com/dss-extensions/electricdss-tst/archive/master.tar.gz"
tempfilename = Base.download(url)
tempfilename = Downloads.download(url)
mkpath(directory)
rm(electricdss_tst_master_folder, recursive=true, force=true)
unzip(os, tempfilename, directory)
Expand Down
3 changes: 2 additions & 1 deletion test/examples.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Downloads

dir = joinpath(@__DIR__, "../examples")

Expand All @@ -11,6 +12,6 @@ dir = joinpath(@__DIR__, "../examples")
@test include(joinpath(dir, "timings.jl")) === nothing

cd(joinpath(@__DIR__, ".."))
@test abspath(download(OpenDSSDirect.Examples, force = true)) == abspath(joinpath(@__DIR__, "../examples/electricdss-tst-master"))
@test abspath(Downloads.download(OpenDSSDirect.Examples, force = true)) == abspath(joinpath(@__DIR__, "../examples/electricdss-tst-master"))

end # testset

0 comments on commit 637fbcd

Please sign in to comment.