Closed zbeekman closed 8 years ago
The problem is that gprof2dot's versions aren't PEP 440-compliant. pip returns a normalized version from pip.get_installed_distributions()
(2015.2.3 instead of 2015.02.03) but pypi doesn't accept a normalized version in its API (https://pypi.python.org/pypi/gprof2dot/2015.2.3/json 404s, https://pypi.python.org/pypi/gprof2dot/2015.02.03/json does not).
poet could try to work around this by making a more generic call to pypi and working harder to interpret it but I'm not feeling inspired.
I really should add better error handling, though.
The problem is that gprof2dot's versions aren't PEP 440-compliant.
https://www.python.org/dev/peps/pep-0440/ states that "Date based release segments are also permitted. " and gives a bunch of examples such as "2012.04".
So PEP 440 compliance doesn't look like the problem to me.
That's fair; I shouldn't have said "compliant." This is allowed and works normally for version comparison purposes. I should have said that the normalized and canonical versions are non-identical, following the rule at https://www.python.org/dev/peps/pep-0440/#integer-normalization.
I'm closing this since I was able to get a Formula worked up... not sure if there are any issues that need further attention, however. Feel free to re-open, @tdsmith
It really is a poet bug, so I'll leave it open.
I think the best way to normalize the version is to steal this code from pip:
def safe_version(version):
"""
Convert an arbitrary string to a standard version string
"""
try:
# normalize the version
return str(packaging.version.Version(version))
except packaging.version.InvalidVersion:
version = version.replace(' ','.')
return re.sub('[^A-Za-z0-9.]+', '-', version)
I think the source of the issue is that poet is trying to fetch information for urllib2 which appears to be part of the standard python library. Give it a try yourself to take a look at the debugging output:
gprof2dot is available through
pip
/PyPi