From 7b43eaa9d8075c3d05fd17d19de12793a9c09692 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 5 Jul 2012 16:36:34 -0400 Subject: 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 --- tools/hacking.py | 6 ++++-- 1 file 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: -- cgit