Add BuildEnvironment._temp_dir to tempdir registry

Similar to the InstallRequirement temp build dir, now we'll be able to
refactor this to be globally managed.
This commit is contained in:
Chris Hunt 2020-01-30 22:04:37 -05:00
parent c35cb7819b
commit bdde27bfd8
3 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,7 @@ from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
from pip._internal.utils.subprocess import call_subprocess
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.ui import open_spinner
@ -54,7 +54,7 @@ class BuildEnvironment(object):
def __init__(self):
# type: () -> None
self._temp_dir = TempDirectory(kind="build-env")
self._temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV)
self._prefixes = OrderedDict((
(name, _Prefix(os.path.join(self._temp_dir.path, name)))

View File

@ -156,7 +156,7 @@ class IndexGroupCommand(Command, SessionCommandMixin):
pip_self_version_check(session, options)
KEEPABLE_TEMPDIR_TYPES = [tempdir_kinds.REQ_BUILD]
KEEPABLE_TEMPDIR_TYPES = [tempdir_kinds.BUILD_ENV, tempdir_kinds.REQ_BUILD]
def with_cleanup(func):

View File

@ -24,7 +24,8 @@ logger = logging.getLogger(__name__)
# Kinds of temporary directories. Only needed for ones that are
# globally-managed.
tempdir_kinds = enum(
REQ_BUILD="req-build"
BUILD_ENV="build-env",
REQ_BUILD="req-build",
)