diff options
author | Dan Willemsen <dwillemsen@google.com> | 2019-11-04 19:21:04 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2019-11-04 19:48:19 -0800 |
commit | 8d4d7bee6d8bd398a07b0aec7043f6ee76769d4c (patch) | |
tree | d6b367bb76f9b41d337f2b3d91741d9bf6779f3b /python/python.go | |
parent | f66a280354c015e9b3650c95db1e74062607ceb2 (diff) |
Add python3 embedded launcher support
Test: m par_test{,3}; build/soong/python/tests/runtest.sh
Change-Id: I9c0fac9e2947616fdeedbfc55026dc3065966e71
Diffstat (limited to 'python/python.go')
-rw-r--r-- | python/python.go | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/python/python.go b/python/python.go index 1b606cbb9..c67c577dc 100644 --- a/python/python.go +++ b/python/python.go @@ -326,9 +326,24 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) { p.properties.Version.Py3.Libs)...) if p.bootstrapper != nil && p.isEmbeddedLauncherEnabled(pyVersion3) { - //TODO(nanzhang): Add embedded launcher for Python3. - ctx.PropertyErrorf("version.py3.embedded_launcher", - "is not supported yet for Python3.") + ctx.AddVariationDependencies(nil, pythonLibTag, "py3-stdlib") + + launcherModule := "py3-launcher" + if p.bootstrapper.autorun() { + launcherModule = "py3-launcher-autorun" + } + ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherTag, launcherModule) + + // Add py3-launcher shared lib dependencies. Ideally, these should be + // derived from the `shared_libs` property of "py3-launcher". However, we + // cannot read the property at this stage and it will be too late to add + // dependencies later. + ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherSharedLibTag, "libsqlite") + + if ctx.Target().Os.Bionic() { + ctx.AddFarVariationDependencies(ctx.Target().Variations(), launcherSharedLibTag, + "libc", "libdl", "libm") + } } default: panic(fmt.Errorf("unknown Python Actual_version: %q for module: %q.", @@ -370,11 +385,11 @@ func (p *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Only Python binaries and test has non-empty bootstrapper. if p.bootstrapper != nil { p.walkTransitiveDeps(ctx) - // TODO(nanzhang): Since embedded launcher is not supported for Python3 for now, - // so we initialize "embedded_launcher" to false. embeddedLauncher := false if p.properties.Actual_version == pyVersion2 { embeddedLauncher = p.isEmbeddedLauncherEnabled(pyVersion2) + } else { + embeddedLauncher = p.isEmbeddedLauncherEnabled(pyVersion3) } p.installSource = p.bootstrapper.bootstrap(ctx, p.properties.Actual_version, embeddedLauncher, p.srcsPathMappings, p.srcsZip, p.depsSrcsZips) |