aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authoryangbill <yangbill@google.com>2019-01-04 18:10:32 +0800
committeryangbill <yangbill@google.com>2019-01-04 18:10:32 +0800
commit7265e5f9c12df059d15bb36789724558265cb8bb (patch)
tree3bf93b7e85d7ac8edde2f5b8768d28399bcdddeb /python
parente7968b192c91020417b25b509dd3d0723cda03ac (diff)
downloadbuild_soong-7265e5f9c12df059d15bb36789724558265cb8bb.tar.gz
build_soong-7265e5f9c12df059d15bb36789724558265cb8bb.tar.bz2
build_soong-7265e5f9c12df059d15bb36789724558265cb8bb.zip
Pass -S option to wrapper for python binary.
Prevent problem for some users using PAR file built by android's build system which cause by the different site package of python installed by user themselves. Bug: 120469915 Test: 1. m atest atest --help 2. apply aosp/861470 full build Change-Id: I72c83f9397f0e88eecfcd32806f1746520299447
Diffstat (limited to 'python')
-rw-r--r--python/scripts/stub_template_host.txt5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/scripts/stub_template_host.txt b/python/scripts/stub_template_host.txt
index 213401dc..a48a86f5 100644
--- a/python/scripts/stub_template_host.txt
+++ b/python/scripts/stub_template_host.txt
@@ -12,6 +12,9 @@ PYTHON_BINARY = '%interpreter%'
MAIN_FILE = '%main%'
PYTHON_PATH = 'PYTHONPATH'
+# Don't imply 'import site' on initialization
+PYTHON_ARG = '-S'
+
def SearchPathEnv(name):
search_path = os.getenv('PATH', os.defpath).split(os.pathsep)
for directory in search_path:
@@ -73,7 +76,7 @@ def Main():
python_program = FindPythonBinary()
if python_program is None:
raise AssertionError('Could not find python binary: ' + PYTHON_BINARY)
- args = [python_program, main_filepath] + args
+ args = [python_program, PYTHON_ARG, main_filepath] + args
os.environ.update(new_env)