Skip to content

Commit

Permalink
Merge pull request #7064 from pradyunsg/rename-correct-build-location
Browse files Browse the repository at this point in the history
Better name for _correct_build_directory
  • Loading branch information
pradyunsg authored Sep 22, 2019
2 parents 359a670 + 596b77c commit c787fcb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(
# Temporary build location
self._temp_build_dir = None # type: Optional[TempDirectory]
# Used to store the global directory where the _temp_build_dir should
# have been created. Cf _correct_build_location method.
# have been created. Cf move_to_correct_build_directory method.
self._ideal_build_dir = None # type: Optional[str]
# Set to True after successful installation
self.install_succeeded = None # type: Optional[bool]
Expand Down Expand Up @@ -332,8 +332,8 @@ def ensure_build_location(self, build_dir):
if self.req is None:
# for requirement via a path to a directory: the name of the
# package is not available yet so we create a temp directory
# Once run_egg_info will have run, we'll be able
# to fix it via _correct_build_location
# Once run_egg_info will have run, we'll be able to fix it via
# move_to_correct_build_directory().
# Some systems have /tmp as a symlink which confuses custom
# builds (such as numpy). Thus, we ensure that the real path
# is returned.
Expand All @@ -353,16 +353,16 @@ def ensure_build_location(self, build_dir):
_make_build_dir(build_dir)
return os.path.join(build_dir, name)

def _correct_build_location(self):
def move_to_correct_build_directory(self):
# type: () -> None
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
"""Move self._temp_build_dir to "self._ideal_build_dir/self.req.name"
For some requirements (e.g. a path to a directory), the name of the
package is not available until we run egg_info, so the build_location
will return a temporary directory and store the _ideal_build_dir.
This is only called by self.run_egg_info to fix the temporary build
directory.
This is only called to "fix" the build directory after generating
metadata.
"""
if self.source_dir is not None:
return
Expand Down Expand Up @@ -583,7 +583,7 @@ def prepare_metadata(self):
self.metadata["Version"],
])
)
self._correct_build_location()
self.move_to_correct_build_directory()
else:
metadata_name = canonicalize_name(self.metadata["Name"])
if canonicalize_name(self.req.name) != metadata_name:
Expand Down

0 comments on commit c787fcb

Please sign in to comment.