Skip to content

Commit

Permalink
Revert "Reland #5 of "Force Python 3 to be used in build."""
Browse files Browse the repository at this point in the history
This reverts commit 9ad088f.

Reason for revert: The GPU FYI builders are failing with python errors related to gpu/gles2_conform_support/generate_gles2_conform_tests.py and gpu/gles2_conform_support/generate_gles2_embedded_data.py:

Example: https://ci.chromium.org/p/chromium/builders/ci/GPU%20FYI%20Linux%20Builder%20%28dbg%29/126613

Original change's description:
> Reland #5 of "Force Python 3 to be used in build.""
>
> This CL tries again to switch the compile to use Python3
> by default. Earlier attempts weren't actually testing against
> Python3 because mb.py was overriding the GN dotfile.
>
> This CL changes that, and a long series of fixes between that
> discovery and now have landed, so I think we're ready to try
> again.
>
> Bug: 1112471
> Change-Id: I2d6ffe36692574828be972d7f0bdd9bbf4d9ef83
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2645211
> Commit-Queue: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#863527}

Bug: 1112471
Change-Id: I796466026c79abc231b4fdd0a17fcaca616ce82b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2766146
Auto-Submit: James Darpinian <jdarpinian@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#863549}
  • Loading branch information
jdarpinian authored and Chromium LUCI CQ committed Mar 17, 2021
1 parent 98a1c74 commit b2446a0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ 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: 27 additions & 0 deletions tools/mb/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,33 @@ 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 b2446a0

Please sign in to comment.