-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
don't install empty dirs during wheel installs #1743
Conversation
So you'd like this for a 1.5.5? |
I'm not sure I understand the changes or how they fix things, but pip.wheel is really hard to follow. |
@dstufft in #1632, you say: "So I would say ideally we should only install files (creating any directories we need to)". this change does that, whereas before, we created directories regardless of whether we knew a directory had files.
#1632 was in the 1.5.5 milestone, so I developed against 1.5.X |
I have no idea what's going on. But thanks so much for working on this <3 |
# directory creation is lazy and after the file filtering above | ||
# to ensure we don't install empty dirs | ||
if not os.path.exists(destdir): | ||
os.makedirs(destdir) | ||
shutil.move(srcfile, destfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming files
is a list of all of the files in the Wheel without any empty directories, then we should probably switch this shutil.move
to shutil.copy2()
, then it will fail if we tell it to copy a directory.
The core change looks OK to me. Why did you add a scheme argument? Was that for the tests? Sorry I don't have time to do a full review at the moment. |
yes, for tests, instead of patching. not 100% sure on that, but I try to limit patching when possible. |
I'd also like to write the dist-info stuff out of this function on |
one thing to note is that if someone (on pypy) happens to manually use If that concerns anyone, then maybe a special case in the uninstall logic that looks specifically for empty thoughts? |
People manually calling Alex On Thu, Apr 24, 2014 at 12:15 PM, Marcus Smith notifications@github.comwrote:
"I disapprove of what you say, but I will defend to the death your right to |
In which case let's leave it to Debian to patch their pip if they want the compileall bit fixed. I think it's enough of a corner case that I'm not convinced we need to add a special case anyway and this pushes me over to "let's not". |
Eh, it's a general issue with our install code, there's no reason for us to be installing random empty directories, we shouldn't be installing directories at all, we should be installing files. It just happens that the issue that exposed this is a corner case. |
I'm +1 with the patch as a whole. My comment was about the question @qwcode asked about special casing |
Oh, yea I don't see any reason to special case |
don't install empty dirs during wheel installs
I'll get this over to develop as well, in a bit. |
a fix for #1632, that solves the problem by not installing empty directories (including the empty
__pycache__
dirs in pypy under dist-info). this should really only be an issue an odd cases, as packaging doesn't allow/create empty dirs afaiknote that I'm wanting to start a trend here of commiting the src for test packages (when it's something we've constructed) to tests/data/src, and in general use src for project src, and leave packages just for packages.