summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2013-01-30 13:44:48 -0800
committerJoe Gordon <jogo@cloudscaling.com>2013-01-30 13:44:48 -0800
commitcdfbbc6f1d4c50594947a0b9339cffffa245f7c5 (patch)
tree8c46d34458d1b8dab3de8af6efb6231177aa1bd7
parentd3f28ed56c218ed7275c66eb647e581ce1654083 (diff)
downloadkeystone-cdfbbc6f1d4c50594947a0b9339cffffa245f7c5.tar.gz
keystone-cdfbbc6f1d4c50594947a0b9339cffffa245f7c5.tar.xz
keystone-cdfbbc6f1d4c50594947a0b9339cffffa245f7c5.zip
import tools/flakes from oslo
Change-Id: I4b73fa1eb045517bb25932d1a85c7fab8186d251
-rw-r--r--openstack-common.conf2
-rw-r--r--tools/flakes.py19
2 files changed, 7 insertions, 14 deletions
diff --git a/openstack-common.conf b/openstack-common.conf
index 6042cc6c..8da06cb0 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -1,7 +1,7 @@
[DEFAULT]
# The list of modules to copy from openstack-common
-modules=cfg,importutils,iniparser,jsonutils,setup,timeutils
+modules=cfg,importutils,iniparser,jsonutils,setup,timeutils,flakes
# The base module to hold the copy of openstack.common
base=keystone
diff --git a/tools/flakes.py b/tools/flakes.py
index 4b93abc2..7f96116c 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
-from pyflakes.scripts.pyflakes import main
+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__
-
- sys.exit(main())
+ orig_builtins = set(pyflakes.checker._MAGIC_GLOBALS)
+ pyflakes.checker._MAGIC_GLOBALS = orig_builtins | set(['_'])
+ sys.exit(pyflakes.main())