From f916fbe3331fa27a66fc4ecdf04b650ae410f80d Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sat, 28 Sep 2019 12:17:41 +0530 Subject: [PATCH] Simplify handling of PEP 517 metadata temp dir --- src/pip/_internal/req/req_install.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 659a494e94e..7172c5a5071 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -594,23 +594,18 @@ def prepare_metadata(self): ) self.req = Requirement(metadata_name) - def cleanup(self): - # type: () -> None - if self._temp_dir is not None: - self._temp_dir.cleanup() - def prepare_pep517_metadata(self): # type: () -> None assert self.pep517_backend is not None # NOTE: This needs to be refactored to stop using atexit - self._temp_dir = TempDirectory(delete=False, kind="req-install") + temp_dir = TempDirectory(kind="modern-metadata") + atexit.register(temp_dir.cleanup) + metadata_dir = os.path.join( - self._temp_dir.path, + temp_dir.path, 'pip-wheel-metadata', ) - atexit.register(self.cleanup) - ensure_dir(metadata_dir) with self.build_env: