diff options
author | Chuck Short <chuck.short@canonical.com> | 2012-12-22 15:36:34 -0600 |
---|---|---|
committer | Chuck Short <chuck.short@canonical.com> | 2012-12-24 08:21:38 -0600 |
commit | a0e06a8e96ccfeee1de0030da0a1a2ac9e6e5aad (patch) | |
tree | e8cb9934751975c804b0cfe1604fe99b3a0cd8ee /tools | |
parent | daf3bdae226a76926a8a877e1ed4bd7046f9192d (diff) | |
download | keystone-a0e06a8e96ccfeee1de0030da0a1a2ac9e6e5aad.tar.gz |
Add pyflakes to tox.ini
Add the ability to use pyflakes.
Change-Id: I1c0a652258fd494bf6754b5b83c47166582a85d0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/flakes.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/flakes.py b/tools/flakes.py new file mode 100644 index 000000000..4b93abc21 --- /dev/null +++ b/tools/flakes.py @@ -0,0 +1,22 @@ +""" + wrapper for pyflakes to ignore gettext based warning: + "undefined name '_'" + + From https://bugs.launchpad.net/pyflakes/+bug/844592 +""" +import __builtin__ +import os +import sys + +from pyflakes.scripts.pyflakes import main + +if __name__ == "__main__": + names = os.environ.get('PYFLAKES_BUILTINS', '_') + names = [x.strip() for x in names.split(',')] + for x in names: + if not hasattr(__builtin__, x): + setattr(__builtin__, x, True) + + del names, os, __builtin__ + + sys.exit(main()) |