summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2022-09-26 11:34:11 -0700
committer Cole Faust <colefaust@google.com> 2022-09-26 12:05:03 -0700
commit40c34500c4f28f59a2496f897448f7663d0dc906 (patch)
treebdb386595a0cef15b0f5096af867b82ed95544ff
parenteb3a900c5c0917343400c34dd932af771ba725d1 (diff)
Add binary properties to python_defaults and add modern_python_path_defaults
So that we can more easily enable these new flags on several modules. It seems you can still apply a python_defaults to a python_library even with this change, so I didn't break it out into a separate python_binary_defaults. Bug: 245583294 Test: m py_dont_import_folder_of_entrypoint_test && out/host/linux-x86/testcases/py_dont_import_folder_of_entrypoint_test/x86_64/py_dont_import_folder_of_entrypoint_test Change-Id: Iecf9c1845df4630bafdea9957eb2450c15f8596b
-rw-r--r--python/Android.bp12
-rw-r--r--python/defaults.go7
-rw-r--r--python/tests/dont_import_folder_of_entrypoint/Android.bp3
3 files changed, 15 insertions, 7 deletions
diff --git a/python/Android.bp b/python/Android.bp
index e49fa6a3c..99c02bd28 100644
--- a/python/Android.bp
+++ b/python/Android.bp
@@ -27,3 +27,15 @@ bootstrap_go_package {
],
pluginFor: ["soong_build"],
}
+
+// We're transitioning all of these flags to be true by default.
+// This is a defaults flag that can be used to easily add all of them to
+// certain modules.
+python_defaults {
+ name: "modern_python_path_defaults",
+ dont_add_top_level_directories_to_path: true,
+ dont_add_entrypoint_folder_to_path: true,
+ proto: {
+ respect_pkg_path: true,
+ },
+}
diff --git a/python/defaults.go b/python/defaults.go
index dba23a729..c54e7d059 100644
--- a/python/defaults.go
+++ b/python/defaults.go
@@ -31,15 +31,12 @@ func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
func defaultsFactory() android.Module {
- return DefaultsFactory()
-}
-
-func DefaultsFactory(props ...interface{}) android.Module {
module := &Defaults{}
- module.AddProperties(props...)
module.AddProperties(
&BaseProperties{},
+ &android.ProtoProperties{},
+ &BinaryProperties{},
)
android.InitDefaultsModule(module)
diff --git a/python/tests/dont_import_folder_of_entrypoint/Android.bp b/python/tests/dont_import_folder_of_entrypoint/Android.bp
index 40f522fc4..fc628134f 100644
--- a/python/tests/dont_import_folder_of_entrypoint/Android.bp
+++ b/python/tests/dont_import_folder_of_entrypoint/Android.bp
@@ -5,8 +5,7 @@ python_test_host {
"mypkg/main.py",
"mypkg/mymodule.py",
],
- dont_add_entrypoint_folder_to_path: true,
- dont_add_top_level_directories_to_path: true,
+ defaults: ["modern_python_path_defaults"],
}
python_test_host {