Commit Graph

24 Commits (main)

Author SHA1 Message Date
Erik Staab c1457823a0 Don't write pyc files if running from Cog
Many tools use vpython so we can avoid pyc writes by
disabling them at this layer.

Bug: b/320565954
Change-Id: I50cd04968810ecc186d5abe6c67e54ae1647c739
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5812665
Commit-Queue: Erik Staab <estaab@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
6 months ago
Yiwei Zhang 1790a4b687 provide a way to override cipd root for *nix systems.
So that it allows depot tools has the ability to write the cipd pkgs
outside of the repo.

windows support will be added in a follow-up change.

Bug: 355430412
Change-Id: I7fabed7ecac8216ba3f3f639217d9e36746241f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5742434
Reviewed-by: Gregory Guterman <guterman@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
7 months ago
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
Josip Sokcevic b4b22453f3 Revert "Resolve symlinks to cipd, vpython3"
This reverts commit c962e86f7b.

Reason for revert: broke MacOS:
realpath: command not found

Original change's description:
> Resolve symlinks to cipd, vpython3
>
> If we point a symlink at vpython3 (or various other tools), it will try
> to resolve the depot_tools path to wherever that symlink is stored. We
> should instead follow the symlink before determining the path.
>
> Prior art:
>
> * in python, we're doing Path.resolve() in many cases
> * in shell, there's a "$(readlink "$(dirname "$0"))" (man/push_to_gs.sh)
>
> BUG=b:270994985
> TEST=symlink to vpython3 works
>
> Change-Id: Ifee014d2571ccf58d830a2702c8a0ea225dd4821
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4295094
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Brian Norris <briannorris@chromium.org>

Bug: b:270994985
Change-Id: I69342f3a52153b8cb1ed4366ede5883dfe5ec0b9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4310530
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 years ago
Brian Norris c962e86f7b Resolve symlinks to cipd, vpython3
If we point a symlink at vpython3 (or various other tools), it will try
to resolve the depot_tools path to wherever that symlink is stored. We
should instead follow the symlink before determining the path.

Prior art:

* in python, we're doing Path.resolve() in many cases
* in shell, there's a "$(readlink "$(dirname "$0"))" (man/push_to_gs.sh)

BUG=b:270994985
TEST=symlink to vpython3 works

Change-Id: Ifee014d2571ccf58d830a2702c8a0ea225dd4821
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4295094
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Brian Norris <briannorris@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
Edward Lesmes df70c81527 depot_tools: Simplify MinGW check.
Check `if [[ $(uname -s) = MINGW* ]]` instead of using
grepping and an additional variable.

Change-Id: I6f2cfbb6743357125e6672b77667ee5e36d3d81e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2127674
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
John Stiles 11f4a84bb1 Add quotes around paths in bash scripts.
This allows git-cl to run successfully when the depot tools are installed to a path with a space in it.

Change-Id: I79fa44d13f89fb0ee1baaa90961b4c4284913c40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2125626
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 17aaea21d4 Reland "depot_tools: Run using Python 3 by default."
This reverts commit e2ac022f0b.

git-cache issues were solved by https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2120966

Original change's description:
> Reland "depot_tools: Run using Python 3 by default."
>
> This is a reland of 01ed358917
>
> * python_runner.sh, gclient, roll-dep and fetch will call vpython
>   (instead of vpython3) when running on Windows under git-bash.
> * vpython3 now detects when running on Windows under git-bash and
>   executes vpython3.bat instead.
> * vpython3.bat calls python3.exe directly instead of calling python3.bat.
>
> Original change's description:
> > depot_tools: Run using Python 3 by default.
> >
> > Run gclient, roll-dep, fetch and custom git commands (i.e. git-cl, git-rebase-update, git-new-branch, etc.)
> > using vpython3 by default.
> >
> > Change-Id: I4eecddafa6ca4c5f82ec097615c79d2a741613e7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2113550
> > Reviewed-by: Anthony Polito <apolito@google.com>
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
>
> Change-Id: I9829141d7ea26a67e655264430151f493e73a930
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2118418
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Anthony Polito <apolito@google.com>

Change-Id: Iff02533f0a11062f335a010c074043c720d5b2ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2121304
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic e2ac022f0b Revert "Reland "depot_tools: Run using Python 3 by default.""
This reverts commit e9013eeb3d.

Reason for revert: https://crbug.com/1064547

Original change's description:
> Reland "depot_tools: Run using Python 3 by default."
> 
> This is a reland of 01ed358917
> 
> * python_runner.sh, gclient, roll-dep and fetch will call vpython
>   (instead of vpython3) when running on Windows under git-bash.
> * vpython3 now detects when running on Windows under git-bash and
>   executes vpython3.bat instead.
> * vpython3.bat calls python3.exe directly instead of calling python3.bat.
> 
> Original change's description:
> > depot_tools: Run using Python 3 by default.
> >
> > Run gclient, roll-dep, fetch and custom git commands (i.e. git-cl, git-rebase-update, git-new-branch, etc.)
> > using vpython3 by default.
> >
> > Change-Id: I4eecddafa6ca4c5f82ec097615c79d2a741613e7
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2113550
> > Reviewed-by: Anthony Polito <apolito@google.com>
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> 
> Change-Id: I9829141d7ea26a67e655264430151f493e73a930
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2118418
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Anthony Polito <apolito@google.com>

TBR=ehmaldonado@chromium.org,ajp@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: Ia382d6e4e330f5a7a7a62e4d369c3fa16fc17333
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2120956
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lesmes e9013eeb3d Reland "depot_tools: Run using Python 3 by default."
This is a reland of 01ed358917

* python_runner.sh, gclient, roll-dep and fetch will call vpython
  (instead of vpython3) when running on Windows under git-bash.
* vpython3 now detects when running on Windows under git-bash and
  executes vpython3.bat instead.
* vpython3.bat calls python3.exe directly instead of calling python3.bat.

Original change's description:
> depot_tools: Run using Python 3 by default.
>
> Run gclient, roll-dep, fetch and custom git commands (i.e. git-cl, git-rebase-update, git-new-branch, etc.)
> using vpython3 by default.
>
> Change-Id: I4eecddafa6ca4c5f82ec097615c79d2a741613e7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2113550
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I9829141d7ea26a67e655264430151f493e73a930
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2118418
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lesmes 7a8bf94894 vpython3: Fix path to python 3
Bug: 1036606
Change-Id: I035250757e346f89390b36d44701f0b6b8d8d024
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1995888
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
5 years ago
Edward Lesmes dfadd9d7a2 Reland "vpython: Specify interpreter to run."
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>
5 years ago
Edward Lesmes 13928b7e7f Revert "vpython: Specify interpreter to run."
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>
5 years ago
Edward Lesmes 797d74a266 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>
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
smut 447b45d423 [vpython] Roll to 98a268c6432f18aedd55d62b9621765316dc2a16
Newer builds of vpython contain vpython3 as well.

Bug: 898348
Change-Id: I63b197690e2ae47bd4c6cd50894c4769e1a18334
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1727581
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: smut <smut@google.com>
6 years ago