Skip to content

Commit

Permalink
Simplify handling of PEP 517 metadata temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Sep 28, 2019
1 parent 33b0240 commit f916fbe
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f916fbe

Please sign in to comment.