diff options
author | 2022-09-26 17:24:08 +0000 | |
---|---|---|
committer | 2022-09-26 17:24:08 +0000 | |
commit | 2f037821b019e06e14f8beabbbcd7c0007812900 (patch) | |
tree | 202a4c0af9b10d95d77f65be6214b25bf367ef90 /python/binary.go | |
parent | 394a12b3150981364ccd1302c56e08c36c91520a (diff) | |
parent | af4b13dbe4c4063f784777fc4f58b6fd4f727c6a (diff) |
Merge "Add flag to not add top-level modules to PYTHONPATH"
Diffstat (limited to 'python/binary.go')
-rw-r--r-- | python/binary.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/python/binary.go b/python/binary.go index af29bb6b8..9c8c1f43b 100644 --- a/python/binary.go +++ b/python/binary.go @@ -116,6 +116,14 @@ type BinaryProperties struct { // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true // explicitly. Auto_gen_config *bool + + // Currently, both the root of the zipfile and all the directories 1 level + // below that are added to the python path. When this flag is set to true, + // only the root of the zipfile will be added to the python path. This flag + // will be removed after all the python modules in the tree have been updated + // to support it. When using embedded_launcher: true, this is already the + // behavior. The default is currently false. + Dont_add_top_level_directories_to_path *bool } type binaryDecorator struct { @@ -128,10 +136,6 @@ type IntermPathProvider interface { IntermPathForModuleOut() android.OptionalPath } -var ( - StubTemplateHost = "build/soong/python/scripts/stub_template_host.txt" -) - func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) { module := newModule(hod, android.MultilibFirst) decorator := &binaryDecorator{pythonInstaller: NewPythonInstaller("bin", "")} @@ -180,9 +184,12 @@ func (binary *binaryDecorator) bootstrap(ctx android.ModuleContext, actualVersio }) } + addTopDirectoriesToPath := !proptools.BoolDefault(binary.binaryProperties.Dont_add_top_level_directories_to_path, false) + binFile := registerBuildActionForParFile(ctx, embeddedLauncher, launcherPath, binary.getHostInterpreterName(ctx, actualVersion), - main, binary.getStem(ctx), append(android.Paths{srcsZip}, depsSrcsZips...)) + main, binary.getStem(ctx), append(android.Paths{srcsZip}, depsSrcsZips...), + addTopDirectoriesToPath) return android.OptionalPathForPath(binFile) } |