Skip to content

Commit

Permalink
py-requirements: Remove hacking dependency and use recent flake8.
Browse files Browse the repository at this point in the history
Without this, when using Python 3.12 and flake8 5.0.4, the following
errors are flagged:
  tests/check_acl_log.py:97:25: E231 missing whitespace after ':'
  tests/check_acl_log.py:102:71: E231 missing whitespace after ':'

This was reported and discussed in a couple of contexts:
https://mail.openvswitch.org/pipermail/ovs-dev/2023-November/409325.html
https://mail.openvswitch.org/pipermail/ovs-dev/2023-November/409277.html

And it's fixed in recent flake8/pycodestyle versions:
PyCQA/flake8#1845 (comment)

Unfortunately we have to remove the 'hacking' requirement because that
introduces a dependency on 'flake8<4.0.0 and >=3.6.0'.  On the other
hand the currently enabled hacking checks were only applicable to
Python 2 code.  OVN has stopped supporting Python 2 for a while now,
since 0c042c2 ("Require Python 3 and remove support for Python
2.").

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
dceara committed Nov 14, 2023
1 parent 3bf6740 commit 271186f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
5 changes: 1 addition & 4 deletions Documentation/intro/install/general.rst
Expand Up @@ -134,10 +134,7 @@ following to obtain better warnings:

- clang, version 3.4 or later

- flake8 along with the hacking flake8 plugin (for Python code). The automatic
flake8 check that runs against Python code has some warnings enabled that
come from the "hacking" flake8 plugin. If it's not installed, the warnings
just won't occur until it's run on a system with "hacking" installed.
- flake8 (for Python code)

You may find the ovs-dev script found in ``ovs/utilities/ovs-dev.py`` useful.

Expand Down
6 changes: 0 additions & 6 deletions Makefile.am
Expand Up @@ -415,16 +415,10 @@ ALL_LOCAL += flake8-check
# F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
# D*** -- warnings from flake8-docstrings plugin
# H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
# H231 Python 3.x incompatible 'except x,y:' construct
# H232 Python 3.x incompatible octal 077 should be written as 0o77
# H233 Python 3.x incompatible use of print operator
# H238 old style class declaration, use new style (inherit from `object`)
FLAKE8_SELECT = H231,H232,H233,H238
FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,E722,W503,W504,F811,D,H,I
flake8-check: $(FLAKE8_PYFILES)
$(FLAKE8_WERROR)$(AM_V_GEN) \
src='$^' && \
flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
touch $@
endif
Expand Down
4 changes: 2 additions & 2 deletions utilities/containers/py-requirements.txt
@@ -1,7 +1,7 @@
flake8
hacking>=3.0
flake8>=6.1.0
scapy
sphinx
setuptools
pyelftools
pyOpenSSL
pycodestyle>=2.11.0

0 comments on commit 271186f

Please sign in to comment.