Skip to content

Commit

Permalink
avoid the use of 7z.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Mar 28, 2024
1 parent 5aee3c7 commit e5ea36c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "0.6.10"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
Expand All @@ -17,6 +18,7 @@ Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"

[compat]
AbstractTrees = "0.2, 0.3, 0.4"
Expand Down
13 changes: 4 additions & 9 deletions src/WorldOceanDatabase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ using Missings
using Printf
using Dates
import PhysOcean: addprefix!
using Tar
using CodecZlib

"""
extracttar(tarname,dirname)
`tarname` is a tar.gz file to be extract to `dirname`.
"""
function extracttar(tarname,dirname)
if Sys.iswindows()
exe7z = joinpath(Sys.BINDIR, "7z.exe")
if isdefined(Base, :LIBEXECDIR)
exe7z = joinpath(Sys.BINDIR, Base.LIBEXECDIR, "7z.exe")
end

run(pipeline(`$exe7z x $tarname -y -so`, `$exe7z x -si -y -ttar -o$dirname`))
else
run(`tar xzf $(tarname) --directory=$(dirname)`)
open(tarname) do io
Tar.extract(GzipDecompressorStream(io),dirname)
end
end

Expand Down
3 changes: 2 additions & 1 deletion test/test_wod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ using Downloads: download
using PhysOcean: WorldOceanDatabase
using Test


tarname = download("https://dox.uliege.be/index.php/s/2QLL1g6DepKc0TT/download")
woddir = tempname()
mkdir(woddir)

WorldOceanDatabase.extracttar(tarname,woddir)


obsvalue,obslon,obslat,obsdepth,obstime,obsid = WorldOceanDatabase.load(
Float64,woddir,"Temperature"; prefixid = "1977-")

Expand Down

2 comments on commit e5ea36c

@Alexander-Barth
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/103846

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.10 -m "<description of version>" e5ea36ce1d6e4584f9e839264271c486e0bdf51b
git push origin v0.6.10

Please sign in to comment.