Skip to content

Commit 3093a7c

Browse files
authored
PYTHON-5664 extract using tar command (#2636)
1 parent 44baec9 commit 3093a7c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.evergreen/scripts/setup_tests.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from __future__ import annotations
22

33
import base64
4-
import io
54
import os
65
import platform
76
import shutil
87
import stat
9-
import tarfile
108
from pathlib import Path
119
from urllib import request
1210

@@ -117,9 +115,10 @@ def setup_libmongocrypt():
117115
LOGGER.info(f"Fetching {url}...")
118116
with request.urlopen(request.Request(url), timeout=15.0) as response: # noqa: S310
119117
if response.status == 200:
120-
fileobj = io.BytesIO(response.read())
121-
with tarfile.open("libmongocrypt.tar.gz", fileobj=fileobj) as fid:
122-
fid.extractall(Path.cwd() / "libmongocrypt")
118+
with Path("libmongocrypt.tar.gz").open("wb") as f:
119+
f.write(response.read())
120+
Path("libmongocrypt").mkdir()
121+
run_command("tar -xzf libmongocrypt.tar.gz -C libmongocrypt")
123122
LOGGER.info(f"Fetching {url}... done.")
124123

125124
run_command("ls -la libmongocrypt")

0 commit comments

Comments
 (0)