0

gn: Delete python2_action and build/util/python2_action.py

They're now unused :)

Bug: 1205628
Change-Id: I6129f711f206c3e63bb7a1999124c3a6ef4ae057
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3036082
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#902698}
This commit is contained in:
Nico Weber
2021-07-16 22:12:59 +00:00
committed by Chromium LUCI CQ
parent 84702fd27e
commit ea199729bd
2 changed files with 0 additions and 69 deletions

@ -63,48 +63,6 @@ template("python_library") {
}
}
# This is a wrapper around action() that ensures that the script is
# run under a Python2 executable, even if the main script_executable is
# Python3.
#
# It supports all of action()'s arguments.
#
# TODO(crbug.com/1112471): Remove this once everything runs cleanly under
# Python3.
template("python2_action") {
action(target_name) {
# Forward all variables. Ensure that testonly and visibility are forwarded
# explicitly, since this performs recursive scope lookups, which is
# required to ensure their definition from scopes above the caller are
# properly handled. All other variables are forwarded with "*", which
# doesn't perform recursive lookups at all. See https://crbug.com/862232
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
forward_variables_from(invoker,
"*",
[
"testonly",
"visibility",
])
script = "//build/util/python2_action.py"
_rebased_script = rebase_path(invoker.script, root_build_dir)
inputs = []
inputs = [ invoker.script ]
if (defined(invoker.inputs)) {
inputs += invoker.inputs
}
args = []
args = [ _rebased_script ]
if (defined(invoker.args)) {
args += invoker.args
}
}
}
# A template used for actions that execute a Python script, which has an
# associated .pydeps file. In other words:
#

@ -1,27 +0,0 @@
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script for ensuring that a python action runs under Python2, not Python3."""
import subprocess
import sys
if sys.version_info.major == 2:
# If we get here, we're already Python2, so just re-execute the
# command without the wrapper.
exe = sys.executable
elif sys.executable.endswith('.exe'):
# If we get here, we're a Python3 executable likely running on
# Windows, so look for the Python2 wrapper in depot_tools. We
# can't invoke it directly because some command lines might exceed the
# 8K commamand line length limit in cmd.exe, but we can use it to
# find the underlying executable, which we can then safely call.
exe = subprocess.check_output(
['python.bat', '-c',
'import sys; print(sys.executable)']).decode('utf8').strip()
else:
# If we get here, we are a Python3 executable. Hope that we can find
# a `python2.7` in path somewhere.
exe = 'python2.7'
sys.exit(subprocess.call([exe] + sys.argv[1:]))