Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07f622b0 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

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
parent e7c1f631
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -62,9 +62,9 @@ class TagFile(object):
    try:
    try:
      for self.linenum, line in enumerate(file_object):
      for self.linenum, line in enumerate(file_object):
        self.linenum += 1
        self.linenum += 1

        line = re.sub('#.*$', '', line) # strip trailing comments
        line = line.strip()
        line = line.strip()
        if not line or line[0] == '#': continue
        if not line: continue
        parts = re.split(r"\s+", line, 2)
        parts = re.split(r"\s+", line, 2)


        if len(parts) < 2:
        if len(parts) < 2: