Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport humble] Fix compatibility with flake8 version 5 (#387, #410) #451

Merged

Conversation

emersonknapp
Copy link
Contributor

@emersonknapp emersonknapp commented Sep 5, 2023

This is a combined backport of #387 and #410 to Humble.

When building on Ubuntu 20.04 Focal (Tier 3 support) and following the instructions in https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#install-development-tools-and-ros-tools for that platform, flake8 is installed via pip and so is installed at the newer version 5.
ament_lint then fails to run with:

/opt/ros/humble/install/lib/python3.8/site-packages/ament_flake8/main.py:150: in get_flake8_style_guide
    config_finder = config.ConfigFileFinder(
E   AttributeError: module 'flake8.options.config' has no attribute 'ConfigFileFinder'

387 original text

This PR fixes #382 by explicitly adding any exclude args in the flake8 config file (normally configuration/ament_flake8.ini) to the exclude arglist.

Notably, this uses the same parsing logic that the version of flake8 ROS is using on focal and jammy (3.9.7 and 4.0.0).
I tried to account for differences in the parsing logic between 3.9.7 and 4.0.0 with a try except clause.

410 original text

  • Fix compatibility with flake8 version 5

The ConfigFileFinder class no longer exists in flake8 version 5.
The get_style_guide() code has been updated from the latest
api.legacy.get_style_guide() in flake8.

@emersonknapp emersonknapp force-pushed the emersonknapp/humble-backport-410 branch 2 times, most recently from e30c2cd to 8d34ab1 Compare September 6, 2023 00:18
@clalancette clalancette self-assigned this Sep 14, 2023
@emersonknapp emersonknapp changed the title [backport humble] Fix compatibility with flake8 version 5 (#410) [backport humble] Fix compatibility with flake8 version 5 (#387, #410) Sep 14, 2023
methylDragon and others added 2 commits September 14, 2023 12:55
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
* Fix compatibility with flake8 version 5

The ConfigFileFinder class no longer exists in flake8 version 5.
The get_style_guide() code has been updated from the latest
api.legacy.get_style_guide() in flake8.

Signed-off-by: Timo Röhling <roehling@debian.org>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Emerson Knapp <emerson.b.knapp@gmail.com>
@emersonknapp
Copy link
Contributor Author

Rebased and re-pushed, branch produced by

git cherry-pick 66c76cc  # 387
git cherry-pick 6adf864  # 410
git rebase --signoff origin/humble

Copy link
Contributor

@clalancette clalancette 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 iterating. It looks good to me with green CI.

@emersonknapp
Copy link
Contributor Author

Pulls: #451
Gist: https://gist.githubusercontent.com/emersonknapp/004f93b823abd35d251b4153e4cb8022/raw/891034bcc1a07396dbd14a76ccbbfd1f0e56058e/ros2.repos
BUILD args:
TEST args:
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/12671

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@emersonknapp
Copy link
Contributor Author

@clalancette merge please!

@clalancette clalancette merged commit ae193ac into ament:humble Sep 20, 2023
3 checks passed
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.

None yet

4 participants