PRESUBMIT.py files can invoke other scripts, and those scripts may be
run under Python 2 or Python 3. There are multiple mechanisms that
govern which version will be used, sometimes requiring several flags
to be passed.
This change removes support for Python 2 from this system, thus making
it simpler to invoke Python 3 scripts.
The function parameters that are used to select Python versions are
passed in from multiple places so they still need to be supported, but
they are now ignored. The parameters are deleted to prevent accidental
use.
This change was tested by running this command in a Chromium repo:
git cl presubmit --force --all
Bug: 1207012
Change-Id: I4adc7164417e155ff80d3a039cf36ed030756456
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4328470
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
The initial version of detecting Python 2 usage in presubmit child
scripts used a text file in depot_tools to record Python 2 usage. This
caused problems in chromeos so this change moves to the file to the temp
directory, which is where it should have been in the first place.
Bug: 1366661
Change-Id: I003b813d7bd5f70956dd3418f86e8ed6edf88220
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3954470
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Once this is rolled out, we will no longer need to bootstrap python(3)
in the vpython wrapper, only vpython itself.
Bug: 1318617
Change-Id: If11b81f19d1d15eda74aae94ddc95c2997148c8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3760318
Reviewed-by: Chenlin Fan <fancl@chromium.org>
Commit-Queue: Brian Ryner <bryner@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
While all Chromium PRESUBMIT.py scripts have been running on Python 2
for a long time they continue to invoke child scripts under Python 2.
Part of the reason for slow progress on this transition is that it is
not easy to tell that this is happening, and most developers probably
assume that Python 3 presubmits implies a lack of Python 2.
This change adds a warning when it detects Python 2 scripts being run.
Typical output (edited for clarity) looks like this:
git cl presubmit --files "chrome/updater/tools/*;ppapi/generators/*"
...
Python 2 scripts were run during Python 3 presubmits. Please ask ??? if help is needed in preventing this.
"depot_tools\pylint-1.5" --args-on-stdin from chrome\updater\tools \
"depot_tools\pylint-1.5" --args-on-stdin from chrome\updater\tools \
idl_tests.py from ppapi\generators
If Python 2 scripts launch child scripts, especially if they use
sys.executable, then they will not be reported. However this is a good
thing because it means that the report focuses on the top-level scripts
that drive Python 2 usage.
This change works by modifying vpython.bat to write invocation
information to a text file. The data in this text file is picked up by
presubmit_support.py when it finishes running a set of presubmits.
Bug: 1313804
Change-Id: Ic632b38eae07eca2e02e94358305cc9c998818e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3699002
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This reverts commit bc93924b3b.
Reason for revert: https://crbug.com/1308393
Original change's description:
> Add VPYTHON_BYPASS support for vpython on Windows
>
> At Postman, we use a custom build of Electron which is built using a set
> of tools that are managed by us. Till now, we were using the
> VPYTHON_BYPASS environment variable to use our own managed version of
> Python on macOS but unfortunately, on Windows, depot_tools doesn't
> respect the value of this variable, so this change adds support for that
> on Windows too.
>
> Signed-off-by: Darshan Sen <raisinten@gmail.com>
> Change-Id: I63da0495463ace87d34c3c6fad1c03dee108d14b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525642
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Bug: 1308393
Change-Id: I8cea8827e185d516b8f860b2aa8a8f21a75a8b1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3539039
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
At Postman, we use a custom build of Electron which is built using a set
of tools that are managed by us. Till now, we were using the
VPYTHON_BYPASS environment variable to use our own managed version of
Python on macOS but unfortunately, on Windows, depot_tools doesn't
respect the value of this variable, so this change adds support for that
on Windows too.
Signed-off-by: Darshan Sen <raisinten@gmail.com>
Change-Id: I63da0495463ace87d34c3c6fad1c03dee108d14b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525642
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Add revert instructions to .bat and bash files which are the entry
points to various infra tools deployed via CIPD.
Bug: 1206818
Change-Id: Ib0045aea86f29d0f7e3a43c6ff314c4b7aa74171
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2892387
Auto-Submit: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
This reverts commit 0e8b3107e0.
Reason for revert: wrappers aren't being created in python2-bin, other disruptions
Original change's description:
> Remove py batch wrappers from root dir
>
> This removes python.bat and python3.bat batch wrappers from root of this
> repository. This change brings Windows set up closer to unix.
>
> depot_tools provides batch wrappers in python-bin and python2-bin
> directories and user can opt in to use it by adding them to PATH.
>
> Bug: 777069
> Change-Id: Ie7571a49f940e7a69b6c18779499c39aee94d06a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2742181
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Bug: 777069
Change-Id: Ieaadb032249fa5d6eea39668355c0c7de06dfbeb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2747702
Auto-Submit: Dirk Pranke <dpranke@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This removes python.bat and python3.bat batch wrappers from root of this
repository. This change brings Windows set up closer to unix.
depot_tools provides batch wrappers in python-bin and python2-bin
directories and user can opt in to use it by adding them to PATH.
Bug: 777069
Change-Id: Ie7571a49f940e7a69b6c18779499c39aee94d06a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2742181
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This is a reland of 797d74a266
Original change's description:
> vpython: Specify interpreter to run.
>
> Specify the interpreter to run to avoid issues with several
> python installations on Windows.
>
> Bug: 1036606
>
> Change-Id: Ib70d041acc52c940711460219acd8f4ad58637a9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1992608
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Bug: 1036606
Change-Id: Ibf6727249b40c5a9f5f877353c8d42fe66404cf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994215
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This reverts commit 797d74a266.
Reason for revert: Causes pylint to fail executing on "Depot Tools Presubmit (win)".
Original change's description:
> vpython: Specify interpreter to run.
>
> Specify the interpreter to run to avoid issues with several
> python installations on Windows.
>
> Bug: 1036606
>
> Change-Id: Ib70d041acc52c940711460219acd8f4ad58637a9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1992608
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=ehmaldonado@chromium.org,apolito@google.com
Change-Id: I5902ceb9db85fdad81e781b51281fba8534a99d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1036606
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994114
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Specify the interpreter to run to avoid issues with several
python installations on Windows.
Bug: 1036606
Change-Id: Ib70d041acc52c940711460219acd8f4ad58637a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1992608
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Have the "update_depot_tools" script also do a CIPD tool sync. This will
ensure that users and systems have access to tooling at sync-time rather
than just-in-time loading them at execution time.
Update the tool boostraps to suppress any sort of syncing logs, if it
does happen. This will ensure that users who execute the tools don't see
unexpected output.
BUG=chromium:748651
TEST=local
- Tested on Mac and Windows.
Change-Id: I1aad897d885a07beeac40a372a658681720efd2a
Reviewed-on: https://chromium-review.googlesource.com/591229
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
This reverts commit 4d92fe4300.
Reason for revert: This moved the logging from invoking `led` or `vpython` to whenever someone would run something that would end up invoking `update_depot_tools`. It's good that we are calling this when we run update_depot_tools, but we probably should've suppressed the logging there in at least the success case, because now things are even more confusing. See crbug.com/748651.
Original change's description:
> [bootstraps] Sync at gclient, suppress output.
>
> Have the "update_depot_tools" script also do a CIPD tool sync. This will
> ensure that users and systems have access to tooling at sync-time rather
> than just-in-time loading them at execution time.
>
> Update the tool boostraps to suppress any sort of syncing logic, if it
> does happen. This will ensure that users who execute the tools don't se
> unexpected output.
>
> BUG=None
> TEST=local
> - Tested on Mac and Windows.
>
> R=dpranke@chromium.org, iannucci@chromium.org
>
> Change-Id: I8efce8c73cc4e82ffdf5067ba9b917119a81e843
> Reviewed-on: https://chromium-review.googlesource.com/581494
> Commit-Queue: Daniel Jacques <dnj@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
TBR=iannucci@chromium.org,dpranke@chromium.org,dnj@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: None
Change-Id: I2485c9dd2e48a8dbdeebfff5da9d4c708e0edcb7
Reviewed-on: https://chromium-review.googlesource.com/585867
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Have the "update_depot_tools" script also do a CIPD tool sync. This will
ensure that users and systems have access to tooling at sync-time rather
than just-in-time loading them at execution time.
Update the tool boostraps to suppress any sort of syncing logic, if it
does happen. This will ensure that users who execute the tools don't se
unexpected output.
BUG=None
TEST=local
- Tested on Mac and Windows.
R=dpranke@chromium.org, iannucci@chromium.org
Change-Id: I8efce8c73cc4e82ffdf5067ba9b917119a81e843
Reviewed-on: https://chromium-review.googlesource.com/581494
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>