summaryrefslogtreecommitdiff
path: root/libc/tools/generate-NOTICE.py
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-08-14 15:31:17 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-08-14 15:31:18 -0700
commit53493a9b26e9fb665de590abf3502af94eaf3f44 (patch)
tree60c863ca2c3423ce80af9f36325f3b0e4ee07223 /libc/tools/generate-NOTICE.py
parentb6a971962acdf2684fd98658ec6fe6aa9952d84b (diff)
parent261e2232c18619f7bf49fea6d9266eb314bad398 (diff)
Merge "Sort NOTICE entries."
Diffstat (limited to 'libc/tools/generate-NOTICE.py')
-rwxr-xr-xlibc/tools/generate-NOTICE.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/tools/generate-NOTICE.py b/libc/tools/generate-NOTICE.py
index eaae328d7..46152b964 100755
--- a/libc/tools/generate-NOTICE.py
+++ b/libc/tools/generate-NOTICE.py
@@ -34,9 +34,16 @@ copyrights = set()
def ExtractCopyrightAt(lines, i):
hash = lines[i].startswith("#")
+ # Do we need to back up to find the start of the copyright header?
+ start = i
+ if not hash:
+ while start > 0:
+ if "/*" in lines[start - 1]:
+ break
+ start -= 1
+
# Read comment lines until we hit something that terminates a
# copyright header.
- start = i
while i < len(lines):
if "*/" in lines[i]:
break
@@ -138,7 +145,7 @@ for arg in args:
#print path
-for copyright in copyrights:
+for copyright in sorted(copyrights):
print copyright.encode('utf-8')
print
print '-------------------------------------------------------------------'