nova/tools/flakes.py
Joe Gordon 65ee45c641 Add pyflakes option to tox
* Uses pyflakes wrapper to ignore gettext errors
* Based on: https://bugs.launchpad.net/pyflakes/+bug/844592

Change-Id: I4fd947176f5258f89f517acf5dda2ded4a2da15e
2012-12-04 11:53:29 +02:00

23 lines
461 B
Python

import __builtin__
import os
import sys
from pyflakes.scripts.pyflakes import main
"""
wrapper for pyflakes to ignore gettext based warning:
"undefined name '_'"
From https://bugs.launchpad.net/pyflakes/+bug/844592
"""
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())