Fix up a variety of Python version issues.

Review Request #9880 — Created April 19, 2018 and submitted

Information

RBTools
release-1.0.x
30c0d1f...

Reviewers

This change updates our Python version requirements, enabling 3.5+,
getting rid of 2.6, and removing a bunch of workarounds for old
versions.

Based on work by Joshua Olson at https://reviews.reviewboard.org/r/9652/

  • Ran unit tests on Python 2.7 and 3.6.
  • Posted some changes.
Description From Last Updated

E202 whitespace before ')'

reviewbotreviewbot

I just checked Python 2.7.14. This behavior has not changed. #!/usr/bin/env pythopn print raw_input('test: ') (Note that raw_input is what …

chipx86chipx86

These were issues on modern Python 2.7. The problem was with macOS, not a bug in Python. It does look …

chipx86chipx86

E501 line too long (81 > 79 characters)

reviewbotreviewbot

We should handle any normalization required in get_input(), instead of passing str() here, just to ensure consistency and prevent workarounds …

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. rbtools/commands/__init__.py (Diff revision 2)
     
     
     
    Show all issues

    I just checked Python 2.7.14. This behavior has not changed.

    #!/usr/bin/env pythopn
    
    print raw_input('test: ')
    

    (Note that raw_input is what the input from six maps to on Python 2.x.)

    $ python test.py > py.log
    hi
    $ cat py.log
    test: hi
    $ python test.py 2> py.log
    hi
    hi
    $ cat py.log
    test: 
    

    The original bug was saying that the user doesn't get a prompt if redirecting to stdout (due to using the equivalent of rbt diff). That bug is still present with modern Python.

    The real problem here is that the comment is bad. The right solution is probably to have a wrapper function so we aren't working around this in multiple locations.

  3. rbtools/commands/post.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    These were issues on modern Python 2.7. The problem was with macOS, not a bug in Python.

    It does look like it's fixed as of macOS 10.12.6, according to the bug report. I wonder if we want to keep this and do a version check along with the "darwin" check.

  4. 
      
david
Review request changed
Commit:
87ebdb2f0c606d040f24cba157b4873265d4e890
f560e22b0be07f8348795f50830a45b01f55db97

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. rbtools/utils/console.py (Diff revision 4)
     
     
    Show all issues

    We should handle any normalization required in get_input(), instead of passing str() here, just to ensure consistency and prevent workarounds in specific calls.

  3. 
      
david
brennie
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.0.x (bea459c)