summaryrefslogtreecommitdiffstats
path: root/tools/hacking.py
diff options
context:
space:
mode:
authorSean Dague <sdague@linux.vnet.ibm.com>2012-07-05 16:36:34 -0400
committerSean Dague <sdague@linux.vnet.ibm.com>2012-07-05 16:59:48 -0400
commit7b43eaa9d8075c3d05fd17d19de12793a9c09692 (patch)
tree77e06dedd494aea2090f215fda04d256503a409a /tools/hacking.py
parent6c1d7989d9bf4aea16758542e203cbbad2f7c6f0 (diff)
downloadnova-7b43eaa9d8075c3d05fd17d19de12793a9c09692.tar.gz
nova-7b43eaa9d8075c3d05fd17d19de12793a9c09692.tar.xz
nova-7b43eaa9d8075c3d05fd17d19de12793a9c09692.zip
modify hacking.py to not choke on the def of _()
recent openstack-common brought in it's own def of _() which trips up our checking that all _ calls contain a message string. This explicitly excludes the definition of this in function from that check. Fixes LP Bug #1020792. Change-Id: If647d77a5ae5560935bb2e032331c34b896b8614
Diffstat (limited to 'tools/hacking.py')
-rwxr-xr-xtools/hacking.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index b924167f5..2d8ce92bc 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -283,10 +283,12 @@ def check_i18n():
"""
while True:
try:
- token_type, text, _, _, _ = yield
+ token_type, text, _, _, line = yield
except GeneratorExit:
return
- if token_type == tokenize.NAME and text == "_":
+ if (token_type == tokenize.NAME and text == "_" and
+ not line.startswith('def _(msg):')):
+
while True:
token_type, text, start, _, _ = yield
if token_type != tokenize.NL: