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

BUG: finish fix for speeding up "pip install ." #3219

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions .travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
set -e
set -x

# If we're running under Python 3.5, we can't use anything but --asert=plain
# If we're running under Python 3.5, we can't use anything but --assert=plain
if [[ $TOXENV = "py35" ]]; then
export TOXARGS="--assert=plain"
fi

# If we're running under Python 3.6, we can't use anything but --asert=plain
# If we're running under Python 3.6, we can't use anything but --assert=plain
if [[ $TOXENV = "py36" ]]; then
export TOXARGS="--assert=plain"
fi
Expand Down
17 changes: 8 additions & 9 deletions pip/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,7 @@ def unpack_file_url(link, location, download_dir=None):

# If it's a url to a local directory
if os.path.isdir(link_path):
if os.path.isdir(location):
rmtree(location)
shutil.copytree(link_path, location, symlinks=True)
_copy_dist_from_dir(link_path, location)
if download_dir:
logger.info('Link is a directory, ignoring download_dir')
return
Expand Down Expand Up @@ -736,12 +734,6 @@ def _copy_dist_from_dir(link_path, location):
pip install ~/dev/git-repos/python-prompt-toolkit

"""

# Note: This is currently VERY SLOW if you have a lot of data in the
# directory, because it copies everything with `shutil.copytree`.
# What it should really do is build an sdist and install that.
# See https://github.com/pypa/pip/issues/2195

if os.path.isdir(location):
rmtree(location)

Expand All @@ -760,6 +752,13 @@ def _copy_dist_from_dir(link_path, location):
with indent_log():
call_subprocess(sdist_args, cwd=link_path, show_stdout=False)

# determine what .egg-info/ was created and delete it again. otherwise
# it is found on the path for `pip install .` and mistaken for an installed
# version
egg_info_dirs = [s for s in os.listdir(link_path) if s.endswith('.egg-info')]
for dirname in egg_info_dirs:
rmtree(os.path.join(link_path, dirname))

# unpack sdist into `location`
sdist = os.path.join(location, os.listdir(location)[0])
logger.info('Unpacking sdist %s into %s', sdist, location)
Expand Down