Skip to content

Commit c3e6329

Browse files
authored
Rename InstallRequirement.{build_location -> ensure_build_location} (#7021)
Merge pull request #7021 from pradyunsg/refactor/rename-build-location
2 parents 82c2dd4 + ad68984 commit c3e6329

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/pip/_internal/req/req_install.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def from_path(self):
322322
s += '->' + comes_from
323323
return s
324324

325-
def build_location(self, build_dir):
325+
def ensure_build_location(self, build_dir):
326326
# type: (str) -> str
327327
assert build_dir is not None
328328
if self._temp_build_dir.path is not None:
@@ -370,7 +370,7 @@ def _correct_build_location(self):
370370
old_location = self._temp_build_dir.path
371371
self._temp_build_dir.path = None
372372

373-
new_location = self.build_location(self._ideal_build_dir)
373+
new_location = self.ensure_build_location(self._ideal_build_dir)
374374
if os.path.exists(new_location):
375375
raise InstallationError(
376376
'A package already exists in %s; please remove it to continue'
@@ -763,7 +763,7 @@ def ensure_has_source_dir(self, parent_dir):
763763
:return: self.source_dir
764764
"""
765765
if self.source_dir is None:
766-
self.source_dir = self.build_location(parent_dir)
766+
self.source_dir = self.ensure_build_location(parent_dir)
767767

768768
# For editable installations
769769
def install_editable(

src/pip/_internal/wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ def build(
11461146
req.remove_temporary_source()
11471147
# set the build directory again - name is known from
11481148
# the work prepare_files did.
1149-
req.source_dir = req.build_location(
1149+
req.source_dir = req.ensure_build_location(
11501150
self.preparer.build_dir
11511151
)
11521152
# Update the link for this.

tests/unit/test_req_install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_tmp_build_directory(self):
2020
# Make sure we're handling it correctly with real path.
2121
requirement = InstallRequirement(None, None)
2222
tmp_dir = tempfile.mkdtemp('-build', 'pip-')
23-
tmp_build_dir = requirement.build_location(tmp_dir)
23+
tmp_build_dir = requirement.ensure_build_location(tmp_dir)
2424
assert (
2525
os.path.dirname(tmp_build_dir) ==
2626
os.path.realpath(os.path.dirname(tmp_dir))

0 commit comments

Comments
 (0)