cf-platform-eng/concourse-pypi-resource

get: virtualenv fails

drnic opened this issue · 3 comments

drnic commented

https://pypi.python.org/pypi/virtualenv

From https://ci.starkandwayne.com/teams/main/pipelines/sample-python-flask-app-boshrelease/resources/virtualenv

$ fly -t sw check-resource -r sample-python-flask-app-boshrelease/virtualenv
error: check failed with exit status '1':
Traceback (most recent call last):
  File "/opt/resource/check", line 9, in <module>
    load_entry_point('concourse-pypi-resource==0.1.0', 'console_scripts', 'check')()
  File "/usr/local/lib/python3.5/site-packages/pypi_resource/check.py", line 40, in main
    print(check(sys.stdin))
  File "/usr/local/lib/python3.5/site-packages/pypi_resource/check.py", line 32, in check
    versions = pypi.get_versions_from_pypi(input)
  File "/usr/local/lib/python3.5/site-packages/pypi_resource/pypi.py", line 39, in get_versions_from_pypi
    versions = sorted(versions, key=LooseVersion)
  File "/usr/local/lib/python3.5/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/local/lib/python3.5/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: unorderable types: str() < int()

I'll investigate possible causes.

Digging in a little...here's the gist of it:

>>> LooseVersion('1.4.4') < LooseVersion('1.4rc1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: unorderable types: int() < str()

I think we can fix this by moving the dev release filtering (cf. #6) to before we do the version comparisons.

Should be set here. Again, let me know if you have a need for not filtering out the dev releases and we can look into making the filtering optional.

drnic commented