Use cpython3 host prebuilts on most branches
But continue building them on the aosp-build-tools branch, as that's
where the prebuilts come from.
This will allow us to link against openssl for host python, even though
openssl is only available on aosp-build-tools.
Bug: 173151817
Test: ensure prebuilts are used on master, and sources on build-tools
Test: treehugger
Change-Id: I6e96567350cfdb7e1b49acefc1338e0745dc86f3
diff --git a/Lib/Android.bp b/Lib/Android.bp
index ecc8b29..2db3018 100644
--- a/Lib/Android.bp
+++ b/Lib/Android.bp
@@ -14,6 +14,7 @@
filegroup {
name: "py3-stdlib-srcs",
+ visibility: ["//visibility:private"],
srcs: [
"*.py",
"asyncio/**/*.py",
@@ -42,18 +43,60 @@
],
}
-python_library {
+soong_config_module_type {
+ name: "cpython3_python_stdlib",
+ module_type: "python_library",
+ config_namespace: "cpython3",
+ bool_variables: ["force_build_host"],
+ properties: ["defaults"],
+}
+
+python_defaults {
+ name: "py3-stdlib-force-build",
+ defaults_visibility: ["//visibility:private"],
+ target: {
+ linux_glibc: {
+ exclude_srcs: [":py3-stdlib-prebuilt-srcs"],
+ srcs: [":py3-stdlib-srcs"],
+ },
+ darwin: {
+ exclude_srcs: [":py3-stdlib-prebuilt-srcs"],
+ srcs: [":py3-stdlib-srcs"],
+ },
+ },
+}
+
+cpython3_python_stdlib {
name: "py3-stdlib",
is_internal: true,
pkg_path: "stdlib",
- srcs: [":py3-stdlib-srcs"],
host_supported: true,
+ target: {
+ android: {
+ srcs: [":py3-stdlib-srcs"],
+ },
+ linux_bionic: {
+ srcs: [":py3-stdlib-srcs"],
+ },
+ linux_glibc: {
+ srcs: [":py3-stdlib-prebuilt-srcs"],
+ },
+ darwin: {
+ srcs: [":py3-stdlib-prebuilt-srcs"],
+ },
+ },
+ soong_config_variables: {
+ force_build_host: {
+ defaults: ["py3-stdlib-force-build"],
+ },
+ },
}
// Used by prebuilts/build-tools/build-prebuilts.sh to update
// prebuilts/build-tools/common/py3-stdlib
genrule {
name: "py3-stdlib-zip",
+ visibility: ["//visibility:private"],
tools: ["soong_zip"],
cmd: "echo $(in) >$(genDir)/list && " +
"$(location soong_zip) -o $(out) -C external/python/cpython3/Lib -l $(genDir)/list",