Skip to content

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Oct 6, 2018

Travis has a very old version of colorama that can cause the previous version to break instead of ignoring colorama.

Example output with Travis's default colorama 0.2.5 from apt:

    from numba import jit
  File "/home/travis/.local/lib/python2.7/site-packages/numba/__init__.py", line 11, in <module>
    from . import config, errors, runtests, types
  File "/home/travis/.local/lib/python2.7/site-packages/numba/config.py", line 327, in <module>
    _env_reloader = _EnvReloader()
  File "/home/travis/.local/lib/python2.7/site-packages/numba/config.py", line 76, in __init__
    self.reset()
  File "/home/travis/.local/lib/python2.7/site-packages/numba/config.py", line 80, in reset
    self.update(force=True)
  File "/home/travis/.local/lib/python2.7/site-packages/numba/config.py", line 109, in update
    self.process_environ(new_environ)
  File "/home/travis/.local/lib/python2.7/site-packages/numba/config.py", line 319, in process_environ
    from numba.errors import NumbaWarning
  File "/home/travis/.local/lib/python2.7/site-packages/numba/errors.py", line 98, in <module>
    if tuple([int(x) for x in colorama.__version__.split('.')]) < (0, 3, 9):
AttributeError: 'module' object has no attribute '__version__'

This simple patch changes the "ignore if too old" behavior to also ignore colorama with no version present.

@codecov-io
Copy link

Codecov Report

Merging #3384 into master will decrease coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3384      +/-   ##
==========================================
- Coverage   80.65%   80.65%   -0.01%     
==========================================
  Files         390      390              
  Lines       78159    78159              
  Branches     8823     8823              
==========================================
- Hits        63043    63040       -3     
- Misses      13736    13738       +2     
- Partials     1380     1381       +1

Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the report and patch. This seems fine on inspection. We've no real way of testing this apart from building/finding an archaic version of colorama, so I've simply tested the code locally and made sure it doesn't break anything for a recent colorama. I've one minor comment over some white space addition, other than that, this can be merged. Many thanks for your contribution!

Travis has a very old version of colorama that can cause the previous version to break instead of ignoring colorama.
@henryiii
Copy link
Contributor Author

henryiii commented Oct 9, 2018

Just install the python-colorama package on Ubuntu 14.04 (Travis) - that should in theory break your Travis CI instance without this patch.

docker run --rm -it ubuntu:14.04
apt update && apt install python-colorama
python -c "import colorama; print(hasattr(colorama, '__version__'))"

will print False.

@stuartarchibald
Copy link
Contributor

Thanks for the fix up. I looked up the source, seems like it was .VERSION a while back tartley/colorama@b59e61e#diff-09d0a009613d270622c54744aa450fb4R6. The fix is fine, if there's no __version__ it's too old anyway.

Once CI passes, this can be merged. Thanks for your contribution.

@stuartarchibald stuartarchibald merged commit d032706 into numba:master Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants