aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-11-29 12:54:20 -0800
committerDan Willemsen <dwillemsen@google.com>2018-12-03 15:58:45 -0800
commit54c5b61f0acca588b4ca60d6566616facb25efc0 (patch)
treec5c9fd80fd6cf6ad4220fb58cef83c709d4b188d /python
parent263dde779e4e1b04f7b2507162b9d893763e3129 (diff)
downloadbuild_soong-54c5b61f0acca588b4ca60d6566616facb25efc0.tar.gz
build_soong-54c5b61f0acca588b4ca60d6566616facb25efc0.tar.bz2
build_soong-54c5b61f0acca588b4ca60d6566616facb25efc0.zip
python par: trim and convert the entry point at build time
Instead of doing these string operations in the C++ code at every startup of an embedded par, trim and convert the entry point file to a python module path at build time. Test: m Change-Id: I04a6459a80c84a704b8a25a144ab1e19622d6cc3
Diffstat (limited to 'python')
-rw-r--r--python/builder.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/builder.go b/python/builder.go
index 7d4589cc..7ecd4b5e 100644
--- a/python/builder.go
+++ b/python/builder.go
@@ -54,7 +54,8 @@ var (
embeddedPar = pctx.AndroidStaticRule("embeddedPar",
blueprint.RuleParams{
- Command: `echo '$main' > $entryPoint &&` +
+ // `echo -n` to trim the newline, since the python code just wants the name
+ Command: `echo -n '$main' > $entryPoint &&` +
`$mergeParCmd -p --prefix $launcher -e $entryPoint $out $srcsZips && ` +
`chmod +x $out && (rm -f $entryPoint)`,
CommandDeps: []string{"$mergeParCmd"},
@@ -114,7 +115,7 @@ func registerBuildActionForParFile(ctx android.ModuleContext, embeddedLauncher b
Output: binFile,
Implicits: implicits,
Args: map[string]string{
- "main": main,
+ "main": strings.Replace(strings.TrimSuffix(main, pyExt), "/", ".", -1),
"entryPoint": entryPoint,
"srcsZips": strings.Join(srcsZips.Strings(), " "),
"launcher": launcherPath.String(),