logtags: Support # line comments.
Allow # line comments to start anywhere in a line, not just in column 0.
Test: Added trailing # comments to SecurityLogTags.logtags and checked
that 'make droid' still worked.
Test: Piped a few example lines through a small test script to verify
that the following line behaved as expected:
line = re.sub('#.*$', '', line)
Change-Id: Ib7904620adf8da7d11511ef6d8300e5fb4c73c29
diff --git a/tools/event_log_tags.py b/tools/event_log_tags.py
index 645839e..35b2de0 100644
--- a/tools/event_log_tags.py
+++ b/tools/event_log_tags.py
@@ -62,9 +62,9 @@
try:
for self.linenum, line in enumerate(file_object):
self.linenum += 1
-
+ line = re.sub('#.*$', '', line) # strip trailing comments
line = line.strip()
- if not line or line[0] == '#': continue
+ if not line: continue
parts = re.split(r"\s+", line, 2)
if len(parts) < 2: