Set sys.platform value for hermetic Python.
sys.platform is determined at compile/build time. By default, CPython
will give it a "unknown" value if we didn't set the cflag.
Test: adb push device_test /data, adb shell, ./device_test
Bug: b/70218680
Change-Id: If5d914d3c43b1cfd3df1e57c81becacf2ac59e36
diff --git a/Android.bp b/Android.bp
index 8b78e0b..4a4d6e2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -152,6 +152,18 @@
cc_library_static {
name: "py2-interp-python",
defaults: ["py2-interp-defaults"],
+ target: {
+ linux: {
+ cflags: [
+ "-DPLATFORM=\"linux2\"",
+ ],
+ },
+ darwin_x86_64: {
+ cflags: [
+ "-DPLATFORM=\"darwin\"",
+ ],
+ },
+ },
srcs: [
"Python/_warnings.c",
"Python/Python-ast.c",
@@ -315,7 +327,7 @@
android: {
shared_libs: [
"libsqlite",
- ]
+ ],
},
},
}