mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
python: Run flake8 at build time.
If flake8 is installed, run it at build time. Similar to most Makefile targets, run it once and then only run again if the files change. flake8 is set to ignore all error and warning types that currently occur. Future patches will remove items from the ignore list as they are resolved. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -129,6 +129,8 @@ installing the following to obtain better warnings:
|
|||||||
|
|
||||||
- clang, version 3.4 or later
|
- clang, version 3.4 or later
|
||||||
|
|
||||||
|
- flake8 (for Python code)
|
||||||
|
|
||||||
Also, you may find the ovs-dev script found in utilities/ovs-dev.py useful.
|
Also, you may find the ovs-dev script found in utilities/ovs-dev.py useful.
|
||||||
|
|
||||||
Installation Requirements
|
Installation Requirements
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ SUFFIXES =
|
|||||||
check_DATA =
|
check_DATA =
|
||||||
check_SCRIPTS =
|
check_SCRIPTS =
|
||||||
pkgconfig_DATA =
|
pkgconfig_DATA =
|
||||||
|
FLAKE8_PYFILES =
|
||||||
|
|
||||||
scriptsdir = $(pkgdatadir)/scripts
|
scriptsdir = $(pkgdatadir)/scripts
|
||||||
completiondir = $(sysconfdir)/bash_completion.d
|
completiondir = $(sysconfdir)/bash_completion.d
|
||||||
@@ -339,6 +340,12 @@ manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
|
|||||||
CLEANFILES += manpage-check
|
CLEANFILES += manpage-check
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if HAVE_FLAKE8
|
||||||
|
ALL_LOCAL += flake8-check
|
||||||
|
flake8-check: $(FLAKE8_PYFILES)
|
||||||
|
$(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,F401,F811,F821,F841,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
|
||||||
|
endif
|
||||||
|
|
||||||
include $(srcdir)/manpages.mk
|
include $(srcdir)/manpages.mk
|
||||||
$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
|
$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
|
||||||
@$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
|
@$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ OVS_CHECK_OPENSSL
|
|||||||
OVS_CHECK_LIBCAPNG
|
OVS_CHECK_LIBCAPNG
|
||||||
OVS_CHECK_LOGDIR
|
OVS_CHECK_LOGDIR
|
||||||
OVS_CHECK_PYTHON
|
OVS_CHECK_PYTHON
|
||||||
|
OVS_CHECK_FLAKE8
|
||||||
OVS_CHECK_DOT
|
OVS_CHECK_DOT
|
||||||
OVS_CHECK_IF_PACKET
|
OVS_CHECK_IF_PACKET
|
||||||
OVS_CHECK_IF_DL
|
OVS_CHECK_IF_DL
|
||||||
|
|||||||
3
debian/automake.mk
vendored
3
debian/automake.mk
vendored
@@ -75,6 +75,9 @@ EXTRA_DIST += \
|
|||||||
debian/ifupdown.sh \
|
debian/ifupdown.sh \
|
||||||
debian/source/format
|
debian/source/format
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += \
|
||||||
|
debian/ovs-monitor-ipsec
|
||||||
|
|
||||||
check-debian-changelog-version:
|
check-debian-changelog-version:
|
||||||
@DEB_VERSION=`echo '$(VERSION)' | sed 's/pre/~pre/'`; \
|
@DEB_VERSION=`echo '$(VERSION)' | sed 's/pre/~pre/'`; \
|
||||||
if $(FGREP) '($(DEB_VERSION)' $(srcdir)/debian/changelog >/dev/null; \
|
if $(FGREP) '($(DEB_VERSION)' $(srcdir)/debian/changelog >/dev/null; \
|
||||||
|
|||||||
@@ -352,6 +352,18 @@ else:
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
|
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
|
||||||
|
|
||||||
|
dnl Checks for dot.
|
||||||
|
AC_DEFUN([OVS_CHECK_FLAKE8],
|
||||||
|
[AC_CACHE_CHECK(
|
||||||
|
[for flake8],
|
||||||
|
[ovs_cv_flake8],
|
||||||
|
[if flake8 --version >/dev/null 2>&1; then
|
||||||
|
ovs_cv_flake8=yes
|
||||||
|
else
|
||||||
|
ovs_cv_flake8=no
|
||||||
|
fi])
|
||||||
|
AM_CONDITIONAL([HAVE_FLAKE8], [test "$ovs_cv_flake8" = yes])])
|
||||||
|
|
||||||
dnl Checks for dot.
|
dnl Checks for dot.
|
||||||
AC_DEFUN([OVS_CHECK_DOT],
|
AC_DEFUN([OVS_CHECK_DOT],
|
||||||
[AC_CACHE_CHECK(
|
[AC_CACHE_CHECK(
|
||||||
|
|||||||
@@ -82,3 +82,5 @@ ofproto/ipfix-entities.def: ofproto/ipfix.xml ofproto/ipfix-gen-entities
|
|||||||
|
|
||||||
# IPFIX enterprise entity definition macros.
|
# IPFIX enterprise entity definition macros.
|
||||||
EXTRA_DIST += ofproto/ipfix-enterprise-entities.def
|
EXTRA_DIST += ofproto/ipfix-enterprise-entities.def
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += ofproto/ipfix-gen-entities
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
|
|||||||
EXTRA_DIST += $(PYFILES)
|
EXTRA_DIST += $(PYFILES)
|
||||||
PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
|
PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += \
|
||||||
|
$(filter-out python/ovs/dirs.py,$(PYFILES)) \
|
||||||
|
python/setup.py \
|
||||||
|
python/build/__init__.py \
|
||||||
|
python/build/nroff.py \
|
||||||
|
python/ovs/dirs.py.template
|
||||||
|
|
||||||
if HAVE_PYTHON
|
if HAVE_PYTHON
|
||||||
nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
|
nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
|
||||||
ovs-install-data-local:
|
ovs-install-data-local:
|
||||||
|
|||||||
@@ -354,6 +354,8 @@ CHECK_PYFILES = \
|
|||||||
EXTRA_DIST += $(CHECK_PYFILES)
|
EXTRA_DIST += $(CHECK_PYFILES)
|
||||||
PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
|
PYCOV_CLEAN_FILES += $(CHECK_PYFILES:.py=.py,cover) .coverage
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += $(CHECK_PYFILES)
|
||||||
|
|
||||||
if HAVE_OPENSSL
|
if HAVE_OPENSSL
|
||||||
TESTPKI_FILES = \
|
TESTPKI_FILES = \
|
||||||
tests/testpki-cacert.pem \
|
tests/testpki-cacert.pem \
|
||||||
|
|||||||
@@ -153,4 +153,6 @@ bin_PROGRAMS += utilities/ovs-benchmark
|
|||||||
utilities_ovs_benchmark_SOURCES = utilities/ovs-benchmark.c
|
utilities_ovs_benchmark_SOURCES = utilities/ovs-benchmark.c
|
||||||
utilities_ovs_benchmark_LDADD = lib/libopenvswitch.la
|
utilities_ovs_benchmark_LDADD = lib/libopenvswitch.la
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += utilities/ovs-pcap.in
|
||||||
|
|
||||||
include utilities/bugtool/automake.mk
|
include utilities/bugtool/automake.mk
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ scripts_SCRIPTS += \
|
|||||||
docs += vtep/README.ovs-vtep.md
|
docs += vtep/README.ovs-vtep.md
|
||||||
EXTRA_DIST += vtep/ovs-vtep
|
EXTRA_DIST += vtep/ovs-vtep
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += vtep/ovs-vtep
|
||||||
|
|
||||||
# VTEP schema and IDL
|
# VTEP schema and IDL
|
||||||
EXTRA_DIST += vtep/vtep.ovsschema
|
EXTRA_DIST += vtep/vtep.ovsschema
|
||||||
pkgdata_DATA += vtep/vtep.ovsschema
|
pkgdata_DATA += vtep/vtep.ovsschema
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ EXTRA_DIST += \
|
|||||||
xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync \
|
xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync \
|
||||||
xenserver/usr_share_openvswitch_scripts_sysconfig.template
|
xenserver/usr_share_openvswitch_scripts_sysconfig.template
|
||||||
|
|
||||||
|
FLAKE8_PYFILES += \
|
||||||
|
xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
|
||||||
|
|
||||||
$(srcdir)/xenserver/openvswitch-xen.spec: xenserver/openvswitch-xen.spec.in $(top_builddir)/config.status
|
$(srcdir)/xenserver/openvswitch-xen.spec: xenserver/openvswitch-xen.spec.in $(top_builddir)/config.status
|
||||||
$(AM_V_GEN)($(ro_shell) && sed -e 's,[@]VERSION[@],$(VERSION),g') \
|
$(AM_V_GEN)($(ro_shell) && sed -e 's,[@]VERSION[@],$(VERSION),g') \
|
||||||
< $(srcdir)/xenserver/$(@F).in > $(@F).tmp || exit 1; \
|
< $(srcdir)/xenserver/$(@F).in > $(@F).tmp || exit 1; \
|
||||||
|
|||||||
Reference in New Issue
Block a user