Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a temp dir for pip-wheel-metadata #6325

Merged
merged 3 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ nosetests.xml
coverage.xml
*.cover
tests/data/common_wheels/
pip-wheel-metadata

# Misc
*~
Expand Down
1 change: 1 addition & 0 deletions news/6213.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``pip-wheel-metadata`` directory does not need to persist between invocations of pip, use a temporary directory instead of the current ``setup.py`` directory.
15 changes: 13 additions & 2 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import

import atexit
import logging
import os
import shutil
Expand Down Expand Up @@ -552,14 +553,24 @@ 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")
self._temp_dir.create()
metadata_dir = os.path.join(
self.setup_py_dir,
'pip-wheel-metadata'
self._temp_dir.path,
'pip-wheel-metadata',
)
atexit.register(self.cleanup)

ensure_dir(metadata_dir)

with self.build_env:
Expand Down