diff --git a/pip/download.py b/pip/download.py index 73f7baa0c02..4f50795bf9e 100644 --- a/pip/download.py +++ b/pip/download.py @@ -359,7 +359,7 @@ def unpack_file_url(link, location): # delete the location since shutil will create it again :( if os.path.isdir(location): rmtree(location) - shutil.copytree(source, location) + shutil.copytree(source, location, symlinks=True) else: unpack_file(source, location, content_type, link) diff --git a/tests/data/packages/symlinks/doc/intro b/tests/data/packages/symlinks/doc/intro new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/data/packages/symlinks/docs b/tests/data/packages/symlinks/docs new file mode 120000 index 00000000000..325ab0db62d --- /dev/null +++ b/tests/data/packages/symlinks/docs @@ -0,0 +1 @@ +doc \ No newline at end of file diff --git a/tests/data/packages/symlinks/setup.cfg b/tests/data/packages/symlinks/setup.cfg new file mode 100644 index 00000000000..01bb954499e --- /dev/null +++ b/tests/data/packages/symlinks/setup.cfg @@ -0,0 +1,3 @@ +[egg_info] +tag_build = dev +tag_svn_revision = true diff --git a/tests/data/packages/symlinks/setup.py b/tests/data/packages/symlinks/setup.py new file mode 100644 index 00000000000..b71e35f1e1e --- /dev/null +++ b/tests/data/packages/symlinks/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup + +version = '0.1' + +setup(name='symlinks', + version=version, + packages=["symlinks"], + ) diff --git a/tests/data/packages/symlinks/symlinks/__init__.py b/tests/data/packages/symlinks/symlinks/__init__.py new file mode 100644 index 00000000000..792d6005489 --- /dev/null +++ b/tests/data/packages/symlinks/symlinks/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index bf0ed96c6a2..4527c96f53a 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -208,6 +208,18 @@ def test_install_from_local_directory(script, data): assert egg_info_folder in result.files_created, str(result) +def test_install_from_local_directory_with_symlinks_to_directories(script, data): + """ + Test installing from a local directory containing symlinks to directories. + """ + to_install = data.packages.join("symlinks") + result = script.pip('install', to_install, expect_error=False) + pkg_folder = script.site_packages/'symlinks' + egg_info_folder = script.site_packages/'symlinks-0.1dev-py%s.egg-info' % pyversion + assert pkg_folder in result.files_created, str(result.stdout) + assert egg_info_folder in result.files_created, str(result) + + def test_install_from_local_directory_with_no_setup_py(script, data): """ Test installing from a local directory with no 'setup.py'. diff --git a/tests/lib/path.py b/tests/lib/path.py index bbdcafa91e2..3bd608ddf97 100644 --- a/tests/lib/path.py +++ b/tests/lib/path.py @@ -264,7 +264,7 @@ def copytree(self, to): """ Copies a directory tree to another path. """ - return shutil.copytree(self, to) + return shutil.copytree(self, to, symlinks=True) def move(self, to): """