0

build: remove run_under_python2

This is not used now.

Bug: 1275016
Change-Id: I1852c7a02ad5d52e3e9339ed7b164160911d41e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3544547
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#985590}
This commit is contained in:
Takuto Ikuta
2022-03-26 01:01:01 +00:00
committed by Chromium LUCI CQ
parent 96a9ffa156
commit 8b64210513
5 changed files with 9 additions and 27 deletions

@ -30,7 +30,6 @@ action("chromium_git_revision") {
group("test_results") {
data = [
"//.vpython",
"//.vpython3",
"//build/util/lib/__init__.py",
"//build/util/lib/results/",

@ -20,8 +20,6 @@
# build product. Paths can be relative to the containing gn file
# or source-absolute.
# executable_args: List of arguments to write into the wrapper.
# use_vpython3: If false, invoke the generated wrapper with vpython instead
# of vpython3.
#
# Example wrapping a checked-in script:
# generate_wrapper("sample_wrapper") {
@ -70,7 +68,10 @@ template("generate_wrapper") {
if (!defined(data)) {
data = []
}
data += [ _wrapper_script ]
data += [
_wrapper_script,
"//.vpython3",
]
outputs = [ _wrapper_script ]
_rebased_executable_to_wrap =
@ -92,10 +93,6 @@ template("generate_wrapper") {
_script_language,
]
if (!defined(invoker.use_vpython3) || invoker.use_vpython3) {
args += [ "--use-vpython3" ]
data += [ "//.vpython3" ]
}
args += [ "--" ]
args += _wrapped_arguments

@ -1,4 +1,4 @@
#!/usr/bin/env vpython
#!/usr/bin/env python3
# Copyright 2019 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.
@ -15,7 +15,7 @@ import textwrap
# The interpreter doesn't know about the script, so we have bash
# inject the script location.
BASH_TEMPLATE = textwrap.dedent("""\
#!/usr/bin/env {vpython}
#!/usr/bin/env vpython3
_SCRIPT_LOCATION = __file__
{script}
""")
@ -27,7 +27,7 @@ BASH_TEMPLATE = textwrap.dedent("""\
# directly.
BATCH_TEMPLATE = textwrap.dedent("""\
@SETLOCAL ENABLEDELAYEDEXPANSION \
& {vpython}.bat -x "%~f0" %* \
& vpython3.bat -x "%~f0" %* \
& EXIT /B !ERRORLEVEL!
_SCRIPT_LOCATION = __file__
{script}
@ -172,8 +172,7 @@ def Wrap(args):
executable_path=str(args.executable),
executable_args=str(args.executable_args))
template = SCRIPT_TEMPLATES[args.script_language]
wrapper_script.write(
template.format(script=py_contents, vpython=args.vpython))
wrapper_script.write(template.format(script=py_contents))
os.chmod(args.wrapper_script, 0o750)
return 0
@ -195,12 +194,6 @@ def CreateArgumentParser():
'--script-language',
choices=SCRIPT_TEMPLATES.keys(),
help='Language in which the wrapper script will be written.')
parser.add_argument('--use-vpython3',
dest='vpython',
action='store_const',
const='vpython3',
default='vpython',
help='Use vpython3 instead of vpython')
parser.add_argument(
'executable_args', nargs='*',
help='Arguments to wrap into the executable.')

@ -114,9 +114,7 @@ All targets in the build use Python3 now, and anything declared via an
Test targets that run by invoking python scripts (like telemetry_unittests
or blink_web_tests) should eventually migrate to using the [script_test]
GN templates. Once you do that, they will use Python3 by default. However,
some tests may specify `run_under_python2 = true` as a template variable
to use Python2, so when you're ready to test Python3, just delete that line.
GN templates. Once you do that, they will use Python3 by default.
Some tests still need to be migrated to `script_test()`
([crbug.com/1208648](https://crbug.com/1208648)). The process for

@ -971,11 +971,6 @@ template("script_test") {
data = [ invoker.script ]
if (defined(invoker.run_under_python2) && invoker.run_under_python2) {
use_vpython3 = false
data += [ "//.vpython" ]
}
if (defined(invoker.data)) {
data += invoker.data
}