diff options
author | yangbill <yangbill@google.com> | 2021-04-16 16:00:28 +0800 |
---|---|---|
committer | Bill Yang <yangbill@google.com> | 2021-04-19 08:08:34 +0000 |
commit | 3aa297570b792c99550560c37b97823da538dc86 (patch) | |
tree | 2e41c90f6cf36cf8e9dfba8bee571ea77a886cce /python | |
parent | 266fcfb8507a092969a9b6ed81dd9732765ee1ab (diff) |
Change par file generate rules.
Make sure the shebang of the par file is consistent with the main python
script rather than use /usr/bin/python arbitrarily.
Bug: 185399398
Bug: 185094069
Test: m atest ; atest-dev --help
m atest-py2 ; atest-py2-dev --help
Change-Id: Ice4590b3d173e6d11e608c2ca29b297df0dc4089
Diffstat (limited to 'python')
-rw-r--r-- | python/builder.go | 2 | ||||
-rw-r--r-- | python/scripts/stub_template_host.txt | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/python/builder.go b/python/builder.go index dc2d1f127..7d7239c55 100644 --- a/python/builder.go +++ b/python/builder.go @@ -45,7 +45,7 @@ var ( hostPar = pctx.AndroidStaticRule("hostPar", blueprint.RuleParams{ Command: `sed -e 's/%interpreter%/$interp/g' -e 's/%main%/$main/g' $template > $stub && ` + - `echo "#!/usr/bin/env python" >${out}.prefix &&` + + `echo "#!/usr/bin/env $interp" >${out}.prefix &&` + `$mergeParCmd -p --prefix ${out}.prefix -pm $stub $out $srcsZips && ` + `chmod +x $out && (rm -f $stub; rm -f ${out}.prefix)`, CommandDeps: []string{"$mergeParCmd"}, diff --git a/python/scripts/stub_template_host.txt b/python/scripts/stub_template_host.txt index a48a86f51..138404bf3 100644 --- a/python/scripts/stub_template_host.txt +++ b/python/scripts/stub_template_host.txt @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env '%interpreter%' import os import re @@ -82,7 +82,7 @@ def Main(): sys.stdout.flush() retCode = subprocess.call(args) - exit(retCode) + sys.exit(retCode) except: raise finally: |