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

switch 'pip install .' to use sdists, not copytree #3615

Closed
wants to merge 2 commits into from
Closed
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
16 changes: 8 additions & 8 deletions pip/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,7 @@ def unpack_file_url(link, location, download_dir=None, hashes=None):

# If it's a url to a local directory
if is_dir_url(link):
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 @@ -719,11 +717,6 @@ def _copy_dist_from_dir(link_path, location):

"""

# 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 @@ -744,6 +737,13 @@ def _copy_dist_from_dir(link_path, location):
logger.info('Unpacking sdist %s into %s', sdist, location)
unpack_file(sdist, location, content_type=None, link=None)

# copy the original setup.py into `location`, since the shim's
# sys.argv[0] confuses distutils.command.sdist.add_defaults() into not
# automatically adding setup.py to the tarball
logger.info('Copying setup.py from original into %s', location)
shutil.copy(os.path.join(link_path, setup_py),
os.path.join(location, "setup.py"))


class PipXmlrpcTransport(xmlrpc_client.Transport):
"""Provide a `xmlrpclib.Transport` implementation via a `PipSession`
Expand Down