From 65163dd0e1aae11d029dfbe930503cc3c6eb5aa5 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Fri, 8 Apr 2022 11:36:47 +0100 Subject: [PATCH] Update deprecated_at_birth script Make it executable, make it work with python3. Bug: 228451704 Test: $ m api_txt dist $ PREVIOUS_API=prebuilts/sdk/## $ for api in $(ls -1 out/dist/apistubs/android); do frameworks/base/tools/apilint/deprecated_at_birth.py \ out/dist/apistubs/android/$api/api/ \ ${PREVIOUS_API}/$api/api/ done Change-Id: Ib0eda541be68b0b21ae0dea3f51a82b44f7f9e7c --- tools/apilint/deprecated_at_birth.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) mode change 100644 => 100755 tools/apilint/deprecated_at_birth.py diff --git a/tools/apilint/deprecated_at_birth.py b/tools/apilint/deprecated_at_birth.py old mode 100644 new mode 100755 index 297d9c3bcca02..da9f19f19505e --- a/tools/apilint/deprecated_at_birth.py +++ b/tools/apilint/deprecated_at_birth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2021 The Android Open Source Project # @@ -208,17 +208,17 @@ def _parse_stream(f, api={}): def _parse_stream_path(path): api = {} - print "Parsing", path + print("Parsing %s" % path) for f in os.listdir(path): f = os.path.join(path, f) if not os.path.isfile(f): continue if not f.endswith(".txt"): continue if f.endswith("removed.txt"): continue - print "\t", f + print("\t%s" % f) with open(f) as s: api = _parse_stream(s, api) - print "Parsed", len(api), "APIs" - print + print("Parsed %d APIs" % len(api)) + print() return api @@ -306,8 +306,8 @@ if __name__ == "__main__": if "@Deprecated " in i.raw: 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), - format(reset=True))) + print("%s Deprecated at birth %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True), + format(reset=True)))) for f in sorted(failures): - print failures[f] - print + print(failures[f]) + print()