From e56e1640b1399281ae0da3c854a9c4056615fb5f Mon Sep 17 00:00:00 2001 From: Jan Skoda Date: Sun, 24 Nov 2019 10:52:41 +0100 Subject: [PATCH 1/3] fix downloading packages from simplepypi --- poetry/utils/inspector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poetry/utils/inspector.py b/poetry/utils/inspector.py index 767f0946542..f5014392480 100644 --- a/poetry/utils/inspector.py +++ b/poetry/utils/inspector.py @@ -127,7 +127,7 @@ def inspect_sdist( gz = GzipFile(str(file_path)) suffix = ".tar.gz" - tar = tarfile.TarFile(str(file_path), fileobj=gz) + tar = tarfile.open(str(file_path)) try: tar.extractall(os.path.join(str(file_path.parent), "unpacked")) From 422784fe66460f624868d8e0a599fc8d811b42e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0koda?= Date: Thu, 9 Jan 2020 16:40:06 +0100 Subject: [PATCH 2/3] unused code removed --- poetry/utils/inspector.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/poetry/utils/inspector.py b/poetry/utils/inspector.py index f5014392480..8bcabf926e3 100644 --- a/poetry/utils/inspector.py +++ b/poetry/utils/inspector.py @@ -114,17 +114,14 @@ def inspect_sdist( # Still not dependencies found # So, we unpack and introspect suffix = file_path.suffix - gz = None if suffix == ".zip": tar = zipfile.ZipFile(str(file_path)) else: if suffix == ".bz2": - gz = BZ2File(str(file_path)) suffixes = file_path.suffixes if len(suffixes) > 1 and suffixes[-2] == ".tar": suffix = ".tar.bz2" else: - gz = GzipFile(str(file_path)) suffix = ".tar.gz" tar = tarfile.open(str(file_path)) @@ -132,9 +129,6 @@ def inspect_sdist( try: tar.extractall(os.path.join(str(file_path.parent), "unpacked")) finally: - if gz: - gz.close() - tar.close() unpacked = file_path.parent / "unpacked" From 3b8ba3594d2bf4d5be232bef0cce2227757827aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0koda?= Date: Thu, 9 Jan 2020 16:42:57 +0100 Subject: [PATCH 3/3] remove unused imports --- poetry/utils/inspector.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/poetry/utils/inspector.py b/poetry/utils/inspector.py index 8bcabf926e3..f1675273b47 100644 --- a/poetry/utils/inspector.py +++ b/poetry/utils/inspector.py @@ -3,8 +3,6 @@ import tarfile import zipfile -from bz2 import BZ2File -from gzip import GzipFile from typing import Dict from typing import List from typing import Union