Skip to content

Conversation

dangra
Copy link
Contributor

@dangra dangra commented Mar 17, 2014

v1.10 is current latest: http://docs.docker.io/en/latest/reference/api/docker_remote_api/#v1-10

docker-py fails to compare it due to a float based implementation:

>>> from docker import utils
>>> utils.compare_version('1.8', '1.9')
0.09999999999999987
>>> utils.compare_version('1.9', '1.10')
-0.7999999999999998

after this change:

>>> utils.compare_version('1.8', '1.9')
1
>>> utils.compare_version('1.9', '1.10')
1

@mpetazzoni
Copy link
Contributor

Thanks. cmp() doesn't exist in Python 3 though, as shown by the build failing. Could you fix this in your change? Thanks!

@dangra
Copy link
Contributor Author

dangra commented Mar 18, 2014

@mpetazzoni : thanks for pointing it. should be fixed now.

@dangra
Copy link
Contributor Author

dangra commented Mar 18, 2014

is trunk broken at the moment? some tests failing with unrelated error:

AssertionError: Command should not raise exception: local variable 'authcfg' referenced before assignment

@shin-
Copy link
Contributor

shin- commented Mar 18, 2014

Odd. master seems to be passing though.

@dangra
Copy link
Contributor Author

dangra commented Mar 18, 2014

the new compare_version was returning the result inverted and that triggered two hidden bugs in support code for older API versions.

I rebased and included a fix for those errors too, but as the codepath for old API versions is not tested it is hard to tell when it will break again, how long do you plan to support old API versions in docker-py?

shin- added a commit that referenced this pull request Mar 18, 2014
Fix API version comparison for 1.10
@shin- shin- merged commit 7ea1195 into docker:master Mar 18, 2014
@dangra dangra deleted the strict-version branch March 18, 2014 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants