From 8a038ed871230ba6280642b5c0e83a37d076aa79 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 26 Mar 2024 17:18:38 -0700 Subject: [PATCH] Make embedded_launcher true by default embedded_launcher causes the python interpreter to be bundled in the built zip file. This is beneficial because: - You can export the built executable and run it on systems without python or an old version of python. The CI servers have python 3.7, so it's useful to update that. - Because the python version is known, the python sources will be precompiled. - It will start running the code directly from the zip file, without extracting the binary to a temporary directory like non-embedded launcher binaries. This is particuarly useful because some developers use the extracted files directly instead of using `importlib.resources`, so having the non-extracting implementation gives them a nudge in the right direction. Make embedded_launcher the default so that more developers will do the right thing when developing python programs. Bug: 331488610 Test: Presubmits Change-Id: Ideb113a1d4d3b29ac04d57a48d111a99f77b2dfc --- python/binary.go | 2 +- python/python.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/binary.go b/python/binary.go index d6750c655..c84eeeedb 100644 --- a/python/binary.go +++ b/python/binary.go @@ -203,7 +203,7 @@ func (p *PythonBinaryModule) OutputFiles(tag string) (android.Paths, error) { } func (p *PythonBinaryModule) isEmbeddedLauncherEnabled() bool { - return Bool(p.properties.Embedded_launcher) + return BoolDefault(p.properties.Embedded_launcher, true) } func (b *PythonBinaryModule) autorun() bool { diff --git a/python/python.go b/python/python.go index d3cbd7695..3551eb6ef 100644 --- a/python/python.go +++ b/python/python.go @@ -59,7 +59,7 @@ type VersionProperties struct { // list of the Python libraries used only for this Python version. Libs []string `android:"arch_variant"` - // whether the binary is required to be built with embedded launcher for this version, defaults to false. + // whether the binary is required to be built with embedded launcher for this version, defaults to true. Embedded_launcher *bool // TODO(b/174041232): Remove this property }