Commit Graph

23 Commits (e95696ff530d1ef5cc103a4c6f148f983f6a998d)

Author SHA1 Message Date
Mike Frysinger f90cc29837 vpython: clear DEPOT_TOOLS_DIR before running scripts
Once we're done using DEPOT_TOOLS_DIR to bootstrap ourselves, remove
it from the env so it isn't passed to the python script which might
in turn run commands from other depot_tools trees.  Like gclient and
running chromium/src/third_party/depot_tools/ programs.

Bug: 1470590
Change-Id: I3dee847e45896ee25f01054026805277fc373c37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4764126
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2 years ago
Mike Frysinger b9b690ec0e setup & share current uname -s value
Avoid recomputing this value multiple times between vpython & cipd.

Bug: 1469696
Change-Id: If82d58180f94cb2833a5a177f7b1e431e08f2892
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4750040
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2 years ago
Mike Frysinger 248aa8ba81 setup & share path to depot_tools checkout
A lot of scripts like to compute the dirname of $0 to find itself to
load more files.  Have some scripts export & resuse this value so we
avoid recalculating when not needed.

Bug: 1469696
Change-Id: I3aac2e6119dbfa3c68715208df2786f67cdce92e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4750430
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Mike Frysinger 029025a07c vpython: only run uname once
Bug: 1469696
Change-Id: I3a055c0704e8da586c16b3c1a3e0758c398f614b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4745141
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Chenlin Fan <fancl@chromium.org>
Reviewed-by: Chenlin Fan <fancl@chromium.org>
2 years ago
Bruce Dawson b6cb9e0b9a Remove Python 2 support for presubmit Commands
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>
2 years ago
Bruce Dawson c9f904f205 Move python2_usage.txt from depot_tools to temp
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>
2 years ago
Brian Ryner 811ea056ed vpython(3) no longer needs to bootstrap python.
The bundled python interpreter is used instead.

Bug: 1318617
Change-Id: I86c359ad765ecf494a11d199f2e01a711c86d4c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3807202
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Brian Ryner <bryner@google.com>
3 years ago
Brian Ryner 8d81365cf0 Use the bundled interpreter instead of passing -vpython-interpreter.
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>
3 years ago
Bruce Dawson f2b0421fff Report when vpython (Python 2) is run during presubmits
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>
3 years ago
Nodir Turakulov 47a4b0bc59 Add revert instructions
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>
4 years ago
Mike Frysinger 5260b2b204 vpython: use the Chromium version on all platforms
We have a python2 binary available on all platforms already, so use
that instead of relying on the system copy.  This provides consistent
behavior across all platforms and avoids the impending doom when host
distros stop providing python2 packages.

Change-Id: Id48fe343291ba70981a1a65526ba80d1f7ae7d73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2785114
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
4 years ago
Edward Lemur 0ab6a9f6e4 depot_tools: Use system's python for vpython.
Using bootstrapped vpython causes problems like [1] when used on
platforms it was not compiled for (e.g. Fedora).

[1] https://chromium-review.googlesource.com/c/infra/infra/+/1929031

Change-Id: I4e62cd1a4e13eee58143695f54ecf80d3473a862
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1930181
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
John Budorick 6ec8b51bc9 Reland "depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt"
This reverts commit b2bfd55fd5.

Reason for revert: not responsible for crbug.com/1025659

Original change's description:
> Revert "depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt"
> 
> This reverts commit bf26b167a8.
> 
> Reason for revert: spec revert for https://bugs.chromium.org/p/chromium/issues/detail?id=1025659
> 
> Original change's description:
> > depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt
> > 
> > Bug: 1017812
> > Change-Id: I7013e5445ff5917fab813a54fed416d9770d2684
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1913269
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> 
> TBR=dpranke@chromium.org,ehmaldonado@chromium.org,apolito@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: 1017812
> Change-Id: I8e10894a2e835c20ece7d555c21f6ce1f76528a5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1922949
> Reviewed-by: John Budorick <jbudorick@chromium.org>
> Commit-Queue: John Budorick <jbudorick@chromium.org>

Bug: 1017812
Change-Id: I251c6b1a3e3a7b9ac9d21dabe745466c668a8246
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1924494
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
John Budorick b2bfd55fd5 Revert "depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt"
This reverts commit bf26b167a8.

Reason for revert: spec revert for https://bugs.chromium.org/p/chromium/issues/detail?id=1025659

Original change's description:
> depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt
> 
> Bug: 1017812
> Change-Id: I7013e5445ff5917fab813a54fed416d9770d2684
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1913269
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>

TBR=dpranke@chromium.org,ehmaldonado@chromium.org,apolito@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1017812
Change-Id: I8e10894a2e835c20ece7d555c21f6ce1f76528a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1922949
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
5 years ago
Edward Lemur bf26b167a8 depot_tools: Ensure Python is bootstrapped before reading python3_bin_reldir.txt
Bug: 1017812
Change-Id: I7013e5445ff5917fab813a54fed416d9770d2684
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1913269
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
5 years ago
Edward Lemur 9577daf667 depot_tools: Don't add a python3 shim to depot_tools on bootstrap.
pythond and python3 are still downloaded from cipd, but python3 is no longer shim'd into
depot_tools on Linux, so is not available on PATH.
Modify PATH in vpython and vpython3 on Linux to point to the python3 download directory,
so that the version downloaded from cipd is used.

Bug: 1017812
Change-Id: I70bc8e7d460f60dcbfa5e141127edecfc2b44744
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1893982
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
5 years ago
Robert Nagy 059f26bcb4 do not hardcode the path to bash by using the #!/usr/bin/env bash shebang
on non-linux systems bash is not the default shell (by default) and
lives in a completely different path

Change-Id: I6580c776dda1b60b3d5c5f5f1ce4d6694ac45fe9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1605902
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Robert Iannucci fc40ad264e [vpython] Implement developer bypass parser in vpython wrapper.
This will allow users on unsupported platforms to successfully bypass vpython
via the recognized environment variable.

R=tandrii@chromium.org, vadimsh@chromium.org

Change-Id: Id63019443321d9f63550fc11e7a4ae3f684b17e7
Reviewed-on: https://chromium-review.googlesource.com/927695
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Dan Jacques 5aeeb72c33 [bootstraps] Sync at gclient, suppress output (#2)
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>
8 years ago
Dirk Pranke 44855b9498 Revert "[bootstraps] Sync at gclient, suppress output."
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>
8 years ago
Dan Jacques 4d92fe4300 [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>
8 years ago
Dan Jacques fa16a83dd2 vpython: proper shebang :)
BUG=None
TEST=None
R=sergeyberezin@chromium.org

Change-Id: I2bb22ad002b82767c6a7efb68412f9c1dbf57c27
Reviewed-on: https://chromium-review.googlesource.com/502228
Reviewed-by: Sergey Berezin <sergeyberezin@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Sergey Berezin 6fee2673e9 Add vpython to depot_tools for linux and mac
BUG=717208
R=dnj@chromium.org

Change-Id: If937a382be9aa4d8eb5f957386e8b1b28cc1c3ac
Reviewed-on: https://chromium-review.googlesource.com/492086
Reviewed-by: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Sergey Berezin <sergeyberezin@chromium.org>
8 years ago