Skip to content

Commit 9fb67c9

Browse files
nhz2ViralBShah
andauthored
Test against unzip_jll (#36)
* use unzip_jll * remove quiet flag * remove other quiet flag * fix typo * Don't test unzip_jll on Windows * add quiet flag --------- Co-authored-by: Viral B. Shah <[email protected]>
1 parent 038850f commit 9fb67c9

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
version: '1.6'
3838
arch: x86
3939
steps:
40-
- uses: actions/checkout@v4
40+
- uses: actions/checkout@v5
4141
- uses: julia-actions/setup-julia@v2
4242
with:
4343
version: ${{ matrix.version }}

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ PrecompileTools = "1"
2121
TranscodingStreams = "0.9, 0.10, 0.11"
2222
Zlib_jll = "1"
2323
julia = "1.6.0"
24+
25+
[workspace]
26+
projects = ["test"]

test/Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
1616
ZipArchives = "49080126-0e18-4c2a-b176-c102e4b3760c"
1717
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
1818
p7zip_jll = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
19-
20-
[sources]
21-
ZipArchives = {path = ".."}
19+
unzip_jll = "88f77b66-78eb-5ed0-bc16-ebba0796830d"

test/external_unzippers.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# These functions take a zipfile path and a directory path and extract the zipfile into the directory
44
import p7zip_jll
55
import LibArchive_jll
6+
import unzip_jll
67
# ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
78
try
89
import PythonCall
@@ -33,6 +34,25 @@ function unzip_bsdtar(zippath, dirpath)
3334
nothing
3435
end
3536

37+
function have_unzip_jll()
38+
# unzip_jll is especially broken on windows.
39+
# https://github.com/JuliaPackaging/Yggdrasil/issues/7679
40+
!Sys.iswindows()
41+
end
42+
43+
"""
44+
Extract the zip file at zippath into the directory dirpath
45+
Use unzip from unzip_jll
46+
"""
47+
function unzip_unzip_jll(zippath, dirpath)
48+
try
49+
run(`$(unzip_jll.unzip()) -qq $(zippath) -d $(dirpath)`)
50+
catch
51+
# unzip errors if the zip file is empty for some reason
52+
end
53+
nothing
54+
end
55+
3656
function have_python()
3757
isdefined(@__MODULE__, :PythonCall)
3858
end
@@ -81,6 +101,12 @@ unzippers = Any[
81101
unzip_bsdtar,
82102
]
83103

104+
if have_unzip_jll()
105+
push!(unzippers, unzip_unzip_jll)
106+
else
107+
@info "unzip_jll is broken on this platform, skipping `unzip_unzip_jll` tests"
108+
end
109+
84110
if have_python()
85111
push!(unzippers, unzip_python)
86112
else

0 commit comments

Comments
 (0)