Skip to content

Commit 68eb2c4

Browse files
committed
Merge pull request #1311 from mwilliamson/py3-symlinks
Fix: "pip install ." fails on Python 3.3 (with symlinks in local directory)
2 parents a92b190 + 99a4f6f commit 68eb2c4

File tree

8 files changed

+27
-2
lines changed

8 files changed

+27
-2
lines changed

pip/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def unpack_file_url(link, location):
359359
# delete the location since shutil will create it again :(
360360
if os.path.isdir(location):
361361
rmtree(location)
362-
shutil.copytree(source, location)
362+
shutil.copytree(source, location, symlinks=True)
363363
else:
364364
unpack_file(source, location, content_type, link)
365365

tests/data/packages/symlinks/doc/intro

Whitespace-only changes.

tests/data/packages/symlinks/docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doc
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[egg_info]
2+
tag_build = dev
3+
tag_svn_revision = true

tests/data/packages/symlinks/setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import setup
2+
3+
version = '0.1'
4+
5+
setup(name='symlinks',
6+
version=version,
7+
packages=["symlinks"],
8+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#

tests/functional/test_install.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,18 @@ def test_install_from_local_directory(script, data):
208208
assert egg_info_folder in result.files_created, str(result)
209209

210210

211+
def test_install_from_local_directory_with_symlinks_to_directories(script, data):
212+
"""
213+
Test installing from a local directory containing symlinks to directories.
214+
"""
215+
to_install = data.packages.join("symlinks")
216+
result = script.pip('install', to_install, expect_error=False)
217+
pkg_folder = script.site_packages/'symlinks'
218+
egg_info_folder = script.site_packages/'symlinks-0.1dev-py%s.egg-info' % pyversion
219+
assert pkg_folder in result.files_created, str(result.stdout)
220+
assert egg_info_folder in result.files_created, str(result)
221+
222+
211223
def test_install_from_local_directory_with_no_setup_py(script, data):
212224
"""
213225
Test installing from a local directory with no 'setup.py'.

tests/lib/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def copytree(self, to):
264264
"""
265265
Copies a directory tree to another path.
266266
"""
267-
return shutil.copytree(self, to)
267+
return shutil.copytree(self, to, symlinks=True)
268268

269269
def move(self, to):
270270
"""

0 commit comments

Comments
 (0)