-
Notifications
You must be signed in to change notification settings - Fork 3k
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
pip doesn't recreate symlinks in a package #288
Comments
Based on the relevant source code in pip (https://github.com/pypa/pip/blob/develop/pip/util.py#L429), it appears that if this is a bug anywhere, it's in the "tarfile" module of Python itself. Pip isn't doing anything unusual here, just calling extractfile() on TarInfo objects returned from getmembers(), as documented. In this case, that extractfile() call is raising an AttributeError. It might have something to do with the way you're packing up your tar file? If you're able to track this bug down and propose a reasonable workaround that pip could use, I'd be open to that. |
The extractfile() method attempts to extract the target of a symlink rather than the symlink itself; if the target does not yet exist (e.g., because a symlink is extracted before its target), an exception occurs. Regardless of whether this behavior was intended by the Python developers, here is a way to circumvent it (diff obtained against the latest revision in git):
|
Thanks for the patch, could you follow the instructions here to create a clone and a pull request with this commited on a branch. https://github.com/pypa/pip/blob/develop/docs/how-to-contribute.txt |
Pull request here is #293 |
Yes - #288 is the issue number. |
It's not just symlinks, it loses permissions and other TarInfo fields on regular files as well. It's affecting installing gevent on Linux, which uses a ./configure script that should be executable. |
I've filed the "loses permissions" issue as issue #317 to ensure it doesn't get lost. |
Directly extract symbolic links rather than their targets (#288).
Thanks @lebedov for the patch! Sorry it took so long to merge. |
When I attempt to install a package that contains symlinks, pip appears to have difficulty recreating them. In the example below, the symlink from version.py to scikits/cuda/version.py is not recreated and causes installation to fail because setup.py attempts to import version:
The text was updated successfully, but these errors were encountered: