summaryrefslogtreecommitdiffstats
path: root/tools/flakes.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/flakes.py')
-rw-r--r--tools/flakes.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/flakes.py b/tools/flakes.py
index f805fd156..7f96116ca 100644
--- a/tools/flakes.py
+++ b/tools/flakes.py
@@ -2,21 +2,14 @@
wrapper for pyflakes to ignore gettext based warning:
"undefined name '_'"
- From https://bugs.launchpad.net/pyflakes/+bug/844592
+ Synced in from openstack-common
"""
-import __builtin__
-import os
import sys
+import pyflakes.checker
from pyflakes.scripts import pyflakes
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__
-
+ orig_builtins = set(pyflakes.checker._MAGIC_GLOBALS)
+ pyflakes.checker._MAGIC_GLOBALS = orig_builtins | set(['_'])
sys.exit(pyflakes.main())