Migrate insertkeys.py to Python3
PEM files are ASCII-encoded, open them as text file (as opposed to
binary). Avoid relying on __del__. Introduce a prologue and epilogue
methods to emit the <policy> tag only once per output.
Test: build plat_mac_permissions.xml on bramble and compare with
previous version; identical
Test: build product_mac_permissions.xml on bramble and compare with
previous version; identical
Test: build system_ext_mac_permissions.xml on bramble and compare with
previous version; identical
Test: build vendor_mac_permissions.xml on bramble and compare with
previous version; identical
Bug: 200119288
Change-Id: Iced0acf75bff756453918a411aecb9f4ef8f825d
diff --git a/tools/Android.bp b/tools/Android.bp
index a6a15a5..c480dc2 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -59,8 +59,7 @@
srcs: ["version_policy.c"],
}
-cc_prebuilt_binary {
- name: "insertkeys.py",
+python_binary_host {
+ name: "insertkeys",
srcs: ["insertkeys.py"],
- host_supported: true,
}