~ubuntu-branches/ubuntu/raring/cinder/raring-updates

« back to all changes in this revision

Viewing changes to tools/flakes.py

Tags: upstream-2013.1~g2
ImportĀ upstreamĀ versionĀ 2013.1~g2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
 wrapper for pyflakes to ignore gettext based warning:
 
3
     "undefined name '_'"
 
4
 
 
5
 From https://bugs.launchpad.net/pyflakes/+bug/844592
 
6
"""
 
7
import __builtin__
 
8
import os
 
9
import sys
 
10
 
 
11
from pyflakes.scripts.pyflakes import main
 
12
 
 
13
if __name__ == "__main__":
 
14
    names = os.environ.get('PYFLAKES_BUILTINS', '_')
 
15
    names = [x.strip() for x in names.split(',')]
 
16
    for x in names:
 
17
        if not hasattr(__builtin__, x):
 
18
            setattr(__builtin__, x, True)
 
19
 
 
20
    del names, os, __builtin__
 
21
 
 
22
    sys.exit(main())