mirror of https://github.com/pypa/pip
Rename InstallRequirement.{build_location -> ensure_build_location} (#7021)
Merge pull request #7021 from pradyunsg/refactor/rename-build-location
This commit is contained in:
commit
c3e6329039
|
@ -322,7 +322,7 @@ class InstallRequirement(object):
|
|||
s += '->' + comes_from
|
||||
return s
|
||||
|
||||
def build_location(self, build_dir):
|
||||
def ensure_build_location(self, build_dir):
|
||||
# type: (str) -> str
|
||||
assert build_dir is not None
|
||||
if self._temp_build_dir.path is not None:
|
||||
|
@ -370,7 +370,7 @@ class InstallRequirement(object):
|
|||
old_location = self._temp_build_dir.path
|
||||
self._temp_build_dir.path = None
|
||||
|
||||
new_location = self.build_location(self._ideal_build_dir)
|
||||
new_location = self.ensure_build_location(self._ideal_build_dir)
|
||||
if os.path.exists(new_location):
|
||||
raise InstallationError(
|
||||
'A package already exists in %s; please remove it to continue'
|
||||
|
@ -763,7 +763,7 @@ class InstallRequirement(object):
|
|||
:return: self.source_dir
|
||||
"""
|
||||
if self.source_dir is None:
|
||||
self.source_dir = self.build_location(parent_dir)
|
||||
self.source_dir = self.ensure_build_location(parent_dir)
|
||||
|
||||
# For editable installations
|
||||
def install_editable(
|
||||
|
|
|
@ -1146,7 +1146,7 @@ class WheelBuilder(object):
|
|||
req.remove_temporary_source()
|
||||
# set the build directory again - name is known from
|
||||
# the work prepare_files did.
|
||||
req.source_dir = req.build_location(
|
||||
req.source_dir = req.ensure_build_location(
|
||||
self.preparer.build_dir
|
||||
)
|
||||
# Update the link for this.
|
||||
|
|
|
@ -20,7 +20,7 @@ class TestInstallRequirementBuildDirectory(object):
|
|||
# Make sure we're handling it correctly with real path.
|
||||
requirement = InstallRequirement(None, None)
|
||||
tmp_dir = tempfile.mkdtemp('-build', 'pip-')
|
||||
tmp_build_dir = requirement.build_location(tmp_dir)
|
||||
tmp_build_dir = requirement.ensure_build_location(tmp_dir)
|
||||
assert (
|
||||
os.path.dirname(tmp_build_dir) ==
|
||||
os.path.realpath(os.path.dirname(tmp_dir))
|
||||
|
|
Loading…
Reference in New Issue