Page MenuHomeSolus

Update flake8 to 3.8.3 and drop python2 support
ClosedPublic

Authored by xulongwu4 on Sep 10 2020, 2:09 AM.
Tags
None
Referenced Files
F11069360: D9620.id.diff
Fri, Aug 11, 10:51 PM
F11069359: D9620.id26210.diff
Fri, Aug 11, 10:51 PM
F11051346: D9620.diff
Thu, Aug 10, 7:57 PM
F11039892: D9620.diff
Thu, Aug 10, 1:24 AM
F10995018: D9620.id.diff
Wed, Jul 26, 2:11 AM
F10956229: D9620.id.diff
Mon, Jul 17, 11:53 AM
F10895462: D9620.id26210.diff
Jul 1 2023, 5:01 PM
F10874754: D9620.id23183.diff
Jun 20 2023, 1:56 AM

Details

Summary

Update flake8 to 3.8.3 and drop python2 support.

Changelog:

  • Add --extend-exclude option to add to --exclude without overwriting
  • Move argument parsing from optparse to argparse
  • Resolve configuration files relative to cwd instead of common prefix of passed filenames
  • # noqa comments now apply to all of the lines in an explicit \ continuation or in a line continued by a multi-line string
  • Improve performance by eliminating unncessary sort
  • Improve messaging of --jobs argument by utilizing argparse
Test Plan

Used it to check styles of python files successfully.

Diff Detail

Repository
R762 flake8
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Dec 16 2020, 9:06 AM

Not comfortable with python2 support being dropped, especially given D10257 was landed when it shouldn't have. We should really be testing python-pycurl in python2 for as long as we have eopkg.

I propose that we should add python2 support for pyflakes and drop python2 for flake8. Just tested locally by rebuilding python-pycurl and pass the build tests.

EDIT: In this stack only pyflakes needs python2 to make python-pycurl build tests work. We can drop python2 also for pycodestyle and autopep8.

Actually the python2 version of flake8 is broken on Solus at the moment, and that is why I am proposing to drop the python2 support. This is the output of running flake8 on my system:

$ flake8
Traceback (most recent call last):
  File "/usr/bin/flake8", line 11, in <module>
    load_entry_point('flake8==3.7.8', 'console_scripts', 'flake8')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/flake8/main/cli.py", line 4, in <module>
    from flake8.main import application
  File "/usr/lib/python2.7/site-packages/flake8/main/application.py", line 16, in <module>
    from flake8.main import options
  File "/usr/lib/python2.7/site-packages/flake8/main/options.py", line 3, in <module>
    from flake8.main import debug
  File "/usr/lib/python2.7/site-packages/flake8/main/debug.py", line 7, in <module>
    import entrypoints
  File "/usr/lib/python2.7/site-packages/entrypoints.py", line 19, in <module>
    from backports import configparser
ImportError: No module named backports

On the other hand, flake83 works fine.

Works for me, you probably uninstalled python-backports somehow

@joebonrichie Thanks for that. My python-backports was broken. Reinstalling it fixed the issue.

@xulongwu4 Just add back python2 for pyflakes in D9621.

@algent I just added back python2 support for pyflakes in D9621