Merge "Update deprecated_at_birth script"
This commit is contained in:
18
tools/apilint/deprecated_at_birth.py
Normal file → Executable file
18
tools/apilint/deprecated_at_birth.py
Normal file → Executable file
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# Copyright (C) 2021 The Android Open Source Project
|
# Copyright (C) 2021 The Android Open Source Project
|
||||||
#
|
#
|
||||||
@@ -208,17 +208,17 @@ def _parse_stream(f, api={}):
|
|||||||
|
|
||||||
def _parse_stream_path(path):
|
def _parse_stream_path(path):
|
||||||
api = {}
|
api = {}
|
||||||
print "Parsing", path
|
print("Parsing %s" % path)
|
||||||
for f in os.listdir(path):
|
for f in os.listdir(path):
|
||||||
f = os.path.join(path, f)
|
f = os.path.join(path, f)
|
||||||
if not os.path.isfile(f): continue
|
if not os.path.isfile(f): continue
|
||||||
if not f.endswith(".txt"): continue
|
if not f.endswith(".txt"): continue
|
||||||
if f.endswith("removed.txt"): continue
|
if f.endswith("removed.txt"): continue
|
||||||
print "\t", f
|
print("\t%s" % f)
|
||||||
with open(f) as s:
|
with open(f) as s:
|
||||||
api = _parse_stream(s, api)
|
api = _parse_stream(s, api)
|
||||||
print "Parsed", len(api), "APIs"
|
print("Parsed %d APIs" % len(api))
|
||||||
print
|
print()
|
||||||
return api
|
return api
|
||||||
|
|
||||||
|
|
||||||
@@ -306,8 +306,8 @@ if __name__ == "__main__":
|
|||||||
if "@Deprecated " in i.raw:
|
if "@Deprecated " in i.raw:
|
||||||
error(clazz, i, None, "Found API deprecation at birth " + i.ident)
|
error(clazz, i, None, "Found API deprecation at birth " + i.ident)
|
||||||
|
|
||||||
print "%s Deprecated at birth %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True),
|
print("%s Deprecated at birth %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True),
|
||||||
format(reset=True)))
|
format(reset=True))))
|
||||||
for f in sorted(failures):
|
for f in sorted(failures):
|
||||||
print failures[f]
|
print(failures[f])
|
||||||
print
|
print()
|
||||||
|
|||||||
Reference in New Issue
Block a user