-
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
make sure that wheel files with a single digit version do work #1445
Conversation
this is a rather serious bug, since it makes 'pip wheel ...' fail with the following error if the wheelhouse contains such a wheel: ,---- | ... | File "/home/ralf/.ve/dev/local/lib/python2.7/site-packages/pip/wheel.py", line 420, in __init__ | self.version = wheel_info.group('ver').replace('_', '-') | AttributeError: 'NoneType' object has no attribute 'replace' `----
the regex as is still allows "ver" to become none, like in >>> import pip.wheel >>> pip.wheel.Wheel("Cython-cp27-none-linux_x86_64.whl") Traceback (most recent call last): File "", line 1, in File "/home/ralf/.ve/dev/local/lib/python2.7/site-packages/pip/wheel.py", line 420, in __init__ self.version = wheel_info.group('ver').replace('_', '-') AttributeError: 'NoneType' object has no attribute 'replace' I'm not sure if wheels without versions should be allowed or if that is also a mistake. |
+1 |
Not saying that we shouldn't be tolerant (and not saying that we should...) but such versions do not conform to PEP 440. |
|
Understood on all these points. I'm not arguing that we shouldn't address the issue, just pointing out that all of the various new features in packaging (and wheel is definitely one of these) are inter-related and based round the new PEPs. I'm only noting this here as a record for whoever reviews the change. I don't even know why PEP 440 disallows single-component versions. |
pywin32 is a popular package that uses single digit versions. |
Note that wheel support for single digit versions is only a small part of the picture. If Metadata 2.0 doesn't support them, other things will fail as well. I'll flag this up on distutils-sig as it's a wider question than just for pip. Feel free to contribute to the discussion over there. |
Agreed that there should be a wider discussion. However, Postel’s Law suggests that pip should do its best to deal with nonconforming package metadata where the intent is clear, if that is possible. In this case, even though some packages have non-conforming metadata, pip is usually able to install them, and separately to build wheels from them. So it seems like there should probably be enough information about the user’s intent here to do install those built wheels. On Jan 15, 2014, at 11:12 AM, Paul Moore notifications@github.com wrote:
|
to me, PEP440 looks like it accepts single digit versions? it even says "Another change to the version scheme is to allow single number versions"
I think the |
correction, I think it's about allowing 1.2.3.4 |
Ah. I read that as Given that this patch simply allows version 1 where version 10 is already allowed (no dots anywhere) and single-component versions are OK, this is clearly just a simple bug fix, so I'm fine with it. I'll leave it a short while longer in case anyone else shouts, then merge it. @schmir thanks for the patch, and sorry for making such a big deal out of it! |
#1445 (comment) still needs to be addressed then. |
I don't see any reason not to merge this, PEP440 allows single versions (and generally uses [ ] to represent optional). |
What exactly needs addressed still? |
@schmir as to your comment, the version-less wheel filename you constructed "Cython-cp27-none-linux_x86_64.whl" would never happen, you just made that up? so, I don't think there's a problem in that our class fails for that, if that's your point |
yes, I've made that up. but why shouldn't I be allowed to put such files into my wheelhouse directory? |
proceeding with merge on this, so that it gets in 1.5.1 @schmir, getting it to raise InvalidWheelFilename is better. feel free to log another issue/PR for that. |
make sure that wheel files with a single digit version do work
you could theoretically hack your filenames, but they're not valid wheels. |
this is a rather serious bug, since it makes 'pip wheel ...' fail with
the following error if the wheelhouse contains such a wheel:
,----
| ...
| File "/home/ralf/.ve/dev/local/lib/python2.7/site-packages/pip/wheel.py", line 420, in init
| self.version = wheel_info.group('ver').replace('_', '-')
| AttributeError: 'NoneType' object has no attribute 'replace'
`----