From 8dd0707218f4472aca007f24661bbd8f61dc8ed2 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 4 Dec 2012 11:52:23 +0200 Subject: [PATCH] Add pyflakes option to tox * Uses pyflakes wrapper to ignore gettext errors * Based on: https://bugs.launchpad.net/pyflakes/+bug/844592 Change-Id: I4fd947176f5258f89f517acf5dda2ded4a2da15e --- flakes.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 flakes.py diff --git a/flakes.py b/flakes.py new file mode 100644 index 0000000..7ebe10c --- /dev/null +++ b/flakes.py @@ -0,0 +1,22 @@ +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())