aboutsummaryrefslogtreecommitdiffstats
path: root/python/python.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2019-02-14 23:17:08 -0800
committerDan Willemsen <dwillemsen@google.com>2019-02-17 12:14:23 -0800
commit6ca390f0b4be216226f31bc05ed5e3bba3105e17 (patch)
tree02f700bed14ed9f6271cbb53f34c1f070bf32e3e /python/python.go
parent41364fe521b39d01404d3df2703f31897389d0f0 (diff)
downloadbuild_soong-6ca390f0b4be216226f31bc05ed5e3bba3105e17.tar.gz
build_soong-6ca390f0b4be216226f31bc05ed5e3bba3105e17.tar.bz2
build_soong-6ca390f0b4be216226f31bc05ed5e3bba3105e17.zip
Support building a par file that does not automatically run
Mainly so that we can build a `python` prebuilt that acts like the normal python install, though you could also build different ones with more packages pre-installed. Bug: 117811537 Test: move built py2-cmd into prebuilts/build-tools/path/linux-x86/python and build Change-Id: I21215f6fd3754d89f8c65e1dfeb3f2deea23239f
Diffstat (limited to 'python/python.go')
-rw-r--r--python/python.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/python/python.go b/python/python.go
index ddc3f1f9..4445f404 100644
--- a/python/python.go
+++ b/python/python.go
@@ -156,6 +156,8 @@ type bootstrapper interface {
bootstrap(ctx android.ModuleContext, ActualVersion string, embeddedLauncher bool,
srcsPathMappings []pathMapping, srcsZip android.Path,
depsSrcsZips android.Paths) android.OptionalPath
+
+ autorun() bool
}
type installer interface {
@@ -307,9 +309,14 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
if p.bootstrapper != nil && p.isEmbeddedLauncherEnabled(pyVersion2) {
ctx.AddVariationDependencies(nil, pythonLibTag, "py2-stdlib")
+
+ launcherModule := "py2-launcher"
+ if p.bootstrapper.autorun() {
+ launcherModule = "py2-launcher-autorun"
+ }
ctx.AddFarVariationDependencies([]blueprint.Variation{
{Mutator: "arch", Variation: ctx.Target().String()},
- }, launcherTag, "py2-launcher")
+ }, launcherTag, launcherModule)
// Add py2-launcher shared lib dependencies. Ideally, these should be
// derived from the `shared_libs` property of "py2-launcher". However, we
@@ -422,7 +429,11 @@ func (p *Module) GeneratePythonBuildActions(ctx android.ModuleContext) {
p.properties.Actual_version, ctx.ModuleName()))
}
expandedSrcs := ctx.ExpandSources(srcs, exclude_srcs)
- if len(expandedSrcs) == 0 {
+ requiresSrcs := true
+ if p.bootstrapper != nil && !p.bootstrapper.autorun() {
+ requiresSrcs = false
+ }
+ if len(expandedSrcs) == 0 && requiresSrcs {
ctx.ModuleErrorf("doesn't have any source files!")
}
@@ -656,4 +667,5 @@ func (p *Module) InstallInData() bool {
}
var Bool = proptools.Bool
+var BoolDefault = proptools.BoolDefault
var String = proptools.String