Skip to content

Commit 5ed2ae5

Browse files
committed
added missing lastest-nightly folder name
1 parent 1064dc8 commit 5ed2ae5

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

setup.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import sysconfig
2222
import tarfile
2323
import urllib.request
24+
import zipfile
2425
from ctypes.util import find_library
2526
from pathlib import Path
2627

@@ -266,12 +267,15 @@ def _download_and_extract(self, filename: str) -> pathlib.Path:
266267

267268
# nightly have different download name and extracted folder name as it
268269
# uses a redirect
269-
# TODO: FIX for zip
270270
if self.is_latest_nightly:
271-
tar = tarfile.open(fpath)
272-
folder = pathlib.Path(pathlib.Path(tar.getmembers()[0].name).parts[0])
271+
if self.archive_format == "zip":
272+
zf = zipfile.ZipFile(fpath)
273+
folder = pathlib.Path(pathlib.Path(zf.namelist()[0]).stem)
274+
else:
275+
tf = tarfile.open(fpath)
276+
folder = pathlib.Path(pathlib.Path(tf.getmembers()[0].name).stem)
273277
else:
274-
folder = fpath.with_name(fpath.name.replace(self.archive_suffix, ""))
278+
folder = fpath.with_name(fpath.stem)
275279
# unless for ZIP, extract to current folder (all files inside an in-tar folder)
276280
extract_to = folder if self.archive_format == "zip" else self.base_dir
277281
shutil.unpack_archive(fpath, extract_to, self.archive_format)

0 commit comments

Comments
 (0)