diff --git a/tools/v8/node_common.py b/tools/v8/node_common.py index f873065c1dfe..ae40d91f0f99 100755 --- a/tools/v8/node_common.py +++ b/tools/v8/node_common.py @@ -6,6 +6,7 @@ # for py2/py3 compatibility from __future__ import print_function +import fileinput import os import pipes import shutil @@ -40,6 +41,16 @@ def _Get(v8_path): depot_tools = _Get(v8_path) assert depot_tools is not None print("Using depot tools in %s" % depot_tools) + # Patch python3 wrapper to not depend on Google's hermetic Python. + for line in fileinput.input(files=(os.path.join(depot_tools, "python-bin", "python3")),inplace=True): + sys.stdout.write(line) + if "DEPOT_TOOLS=$(dirname \"$0\")/.." in line: + sys.stdout.write(""" +if [[ $VPYTHON_BYPASS == \"manually managed python not supported by chrome operations\" ]] +then + exec python3 \"$@\" +fi +""") return depot_tools def UninitGit(v8_path):