summaryrefslogtreecommitdiff
path: root/tools/apilint/apilint.py
diff options
context:
space:
mode:
author Adrian Roos <roosa@google.com> 2019-02-26 11:54:40 +0100
committer Adrian Roos <roosa@google.com> 2019-02-26 11:54:40 +0100
commitb1faa0bf5b5bef39886a2ac2b10ca78eea24a006 (patch)
tree0ccf0c22ffb6a8a4e70ab211aa51f800b4a63e80 /tools/apilint/apilint.py
parent87c1081c4222e490364422a1f21dbec9a35c6791 (diff)
apilint: Correctly parse packages with annotations
Test: python apilint_test.py Change-Id: Ifce9fe3836b2bb46b0d0a255b912fd8bf0195621
Diffstat (limited to 'tools/apilint/apilint.py')
-rw-r--r--tools/apilint/apilint.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py
index 75c3eba7765b..9937ee32c4a6 100644
--- a/tools/apilint/apilint.py
+++ b/tools/apilint/apilint.py
@@ -208,13 +208,14 @@ class Class():
class Package():
+ NAME = re.compile("package(?: .*)? ([A-Za-z.]+)")
+
def __init__(self, line, raw, blame):
self.line = line
self.raw = raw.strip(" {;")
self.blame = blame
- raw = raw.split()
- self.name = raw[raw.index("package")+1]
+ self.name = Package.NAME.match(raw).group(1)
self.name_path = self.name.split(".")
def __repr__(self):