Skip to content

Commit

Permalink
Reland #7 of "Force Python 3 to be used in build."
Browse files Browse the repository at this point in the history
This is a reland of d9caee7.

A number of fixes have landed in between then and now, and I
think we're ready for another round.

Original change's description:
> Reland #6 of "Force Python 3 to be used in build."
>
> This reverts commit b2446a0
>
> Reason for revert: Trying again w/ build fixes.
>
> The two issues we saw yesterday with reland attempt #5
> were fixed in
>   https://crrev.com/c/2768998 (remoting linux installer)
>   https://crrev.com/c/2768998 (GLES test scripts)
>
> But the change wasn't in the tree for very long, so there may
> well be more. Let's try again to see.
>
> Bug: 1112471
> Cq-Include-Trybots: luci.chromium.try:linux-angle-rel
> Cq-Include-Trybots: luci.chrome.try:linux-chrome
> Change-Id: Ie5483d1f6838deeaf0f9b7cddc0bb57a82960c29
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2769361
> Bot-Commit: Rubber Stamper <[email protected]>
> Commit-Queue: Dirk Pranke <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#864372}

Bug: 1112471
Change-Id: Iccef0aa5d92c28fee1ce67e446b9b15a7cc0745a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
Commit-Queue: Dirk Pranke <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Reviewed-by: Bruce Dawson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#868187}
  • Loading branch information
dpranke authored and Chromium LUCI CQ committed Mar 31, 2021
1 parent 03a1d15 commit 0a70004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import("//third_party/angle/dotfile_settings.gni")
# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

# The python interpreter to use by default. On Windows, this will look
# for python3.exe and python3.bat.
script_executable = "python3"

# These arguments override the default values for items in a declare_args
# block. "gn args" in turn can override these.
#
Expand Down
27 changes: 0 additions & 27 deletions tools/mb/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,33 +1090,6 @@ def RunGNGen(self, vals, compute_inputs_for_analyze=False, check=True):
self.WriteFile(gn_runtime_deps_path, '\n'.join(labels) + '\n')
cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path)

# Detect if we are running in a vpython interpreter, and if so force GN to
# use the real python interpreter. crbug.com/1049421
# This ensures that ninja will only use the real python interpreter and not
# vpython, so that any python scripts in the build will only use python
# modules vendored into //third_party.
# This can be deleted when python 3 becomes the only supported interpreter,
# because in python 3 vpython will no longer have its current 'viral'
# qualities and will require explicit usage to opt in to.
prefix = getattr(sys, "real_prefix", sys.prefix)
python_exe = 'python.exe' if self.platform.startswith('win') else 'python'
# The value of prefix varies. Sometimes it extends to include the bin/
# directory of the python install such that prefix/python is the
# interpreter, and other times prefix/bin/python is the interpreter.
# Therefore we need to check both. Also, it is safer to check prefix/bin
# first because there have been previous installs where prefix/bin/python
# was the real binary and prefix/python was actually vpython-native.
possible_python_locations = [
os.path.join(prefix, 'bin', python_exe),
os.path.join(prefix, python_exe),
]
for p in possible_python_locations:
if os.path.isfile(p):
cmd.append('--script-executable=%s' % p)
break
else:
self.Print('python interpreter not under %s' % prefix)

ret, output, _ = self.Run(cmd)
if ret != 0:
if self.args.json_output:
Expand Down

0 comments on commit 0a70004

Please sign in to comment.