summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-12-04 11:52:23 +0200
committerJoe Gordon <jogo@cloudscaling.com>2012-12-04 11:53:29 +0200
commit65ee45c64133e6e451bf93f4960dcb1ab0781c13 (patch)
treecef85692ac77e12922ff99953d013f50a8f74b2f /tools
parentca1a2566d33aad15de640bf60630330aceb0ef2c (diff)
downloadnova-65ee45c64133e6e451bf93f4960dcb1ab0781c13.tar.gz
nova-65ee45c64133e6e451bf93f4960dcb1ab0781c13.tar.xz
nova-65ee45c64133e6e451bf93f4960dcb1ab0781c13.zip
Add pyflakes option to tox
* Uses pyflakes wrapper to ignore gettext errors * Based on: https://bugs.launchpad.net/pyflakes/+bug/844592 Change-Id: I4fd947176f5258f89f517acf5dda2ded4a2da15e
Diffstat (limited to 'tools')
-rw-r--r--tools/flakes.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/flakes.py b/tools/flakes.py
new file mode 100644
index 000000000..7ebe10cec
--- /dev/null
+++ b/tools/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())