[ovs-dev] [PATCH 04/14] check-structs.at: Run for both Python 2 and 3.

Russell Bryant russell at ovn.org
Mon Feb 22 20:16:15 UTC 2016


On Mon, Feb 22, 2016 at 11:53 AM, Ben Pfaff <blp at ovn.org> wrote:

> On Tue, Feb 02, 2016 at 05:36:46PM -0500, Russell Bryant wrote:
> > Update the tests in check-structs.at to run with both Python 2 and 3 if
> > available.  The check-structs script is written in Python, though does
> > not use the ovs Python library.  The script did require fixes in a
> > previous commit to make it Python 3 compatible, so this ensures that
> > compatibility remains.
> >
> > Signed-off-by: Russell Bryant <russell at ovn.org>
>
> With all patches applied, on top of commit b1e04512f7150AA9 (from
> roughly when you posted the patches) I'm getting several errors from
> flake8 regarding check-structs:
>
> ../build-aux/check-structs:70:24: F821 undefined name 'inputFile'
> ../build-aux/check-structs:71:17: F821 undefined name 'lineNumber'
> ../build-aux/check-structs:73:40: F821 undefined name 'inputFile'
> ../build-aux/check-structs:77:40: F821 undefined name 'fileName'
> ../build-aux/check-structs:77:50: F821 undefined name 'inputFile'
> ../build-aux/check-structs:94:23: F821 undefined name 'fileName'
> ../build-aux/check-structs:94:33: F821 undefined name 'lineNumber'
> ../build-aux/check-structs:101:48: F821 undefined name 'fileName'
> ../build-aux/check-structs:101:58: F821 undefined name 'lineNumber'
> ../build-aux/check-structs:111:36: E711 comparison to None should be 'if
> cond is not None:'
>
> I'm using flake8 for Python2, version 2.2.2.
>
> Any ideas?  I haven't investigated yet, except to note that the
> final complaint about comparison to None is correct.
>

I don't get any of those with:

$ flake8 --version
2.5.1 (pep8: 1.6.2, flake8-docstrings: 0.2.4, pep257: 0.7.0, hacking.core:
0.0.1, ProxyChecker: 0.0.1, pyflakes: 1.0.0, mccabe: 0.3.1) CPython 2.7.10
on Linux

The last one does look right.  The rest appear to be flake8 not
understanding 'global'.  Maybe upgrading flake8 would help.  However, I
think I'm just going to drop the two patches related to
build-aux/check-structs.  There's some other Python scripts I ended up not
touching.  The build system would never run this with Python 3.

This would only matter if we update the build system to run everything with
Python 3 if that is installed and Python 2 is not (the default for some
distros these days).  That would require work on several scripts, so this
could just be picked up then.

-- 
Russell Bryant



More information about the dev mailing list