Simplify python launcher, use __main__.py

Uses more python rather than C++, and skips less of Py_Main.

Test: build/soong/python/tests/runtests.sh
Change-Id: I03997d88e2e16047c96bb4e00e530229c42b3325
This commit is contained in:
Dan Willemsen
2018-11-29 21:39:59 -08:00
parent 7b88d7c9f6
commit 707542f298
4 changed files with 26 additions and 40 deletions

12
python/scripts/main.py Normal file
View File

@@ -0,0 +1,12 @@
import runpy
import sys
sys.argv[0] = __loader__.archive
# Set sys.executable to None. The real executable is available as
# sys.argv[0], and too many things assume sys.executable is a regular Python
# binary, which isn't available. By setting it to None we get clear errors
# when people try to use it.
sys.executable = None
runpy._run_module_as_main("ENTRY_POINT", alter_argv=False)