Commit Graph

26 Commits (b5210fdb7491d082965270b650c8080930b91c26)

Author SHA1 Message Date
Stephanie Kim 13f6ecbbbb Reland "[depot_tools] Support both gn paths in gn.py"
This is a reland of commit df8c52a549

Whats changed:
- Only edit the paths created after GetBuildtoolsPlatformBinaryPath()
- Fixed paths (the new paths needed an extra 'gn')
- Check if path isfile(), since the old buildtools/<platform>/gn will
still exist but becomes a directory

Verified locally with buildtools/linux64/gn/gn and
buildtools/linux64/gn

Original change's description:
> [depot_tools] Support both gn paths in gn.py
>
> Build in support for both buildtools/<platform>/gn and
> buildtools/<platform>/gn/gn preemptively.
> This will allow the libfuzzer builders in https://chromium-review.googlesource.com/c/chromium/src/+/5474162 to succeed.
>
> Bug: b/328065301
> Change-Id: I97b401cb1b3339cfa7962f60b891be05baac75d5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5479888
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Stephanie Kim <kimstephanie@google.com>

Bug: b/328065301
Change-Id: I54a9ae12cb51882e80823ab0c89efa0841025a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5482565
Commit-Queue: Stephanie Kim <kimstephanie@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
10 months ago
Stephanie Kim b0e9b98aef Revert "[depot_tools] Support both gn paths in gn.py"
This reverts commit df8c52a549.

Reason for revert: Found bugs

Original change's description:
> [depot_tools] Support both gn paths in gn.py
>
> Build in support for both buildtools/<platform>/gn and
> buildtools/<platform>/gn/gn preemptively.
> This will allow the libfuzzer builders in https://chromium-review.googlesource.com/c/chromium/src/+/5474162 to succeed.
>
> Bug: b/328065301
> Change-Id: I97b401cb1b3339cfa7962f60b891be05baac75d5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5479888
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Stephanie Kim <kimstephanie@google.com>

Bug: b/328065301
Change-Id: I2480e587ce314f7856edc7011fed945e01924371
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5482563
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Stephanie Kim <kimstephanie@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
10 months ago
Stephanie Kim df8c52a549 [depot_tools] Support both gn paths in gn.py
Build in support for both buildtools/<platform>/gn and
buildtools/<platform>/gn/gn preemptively.
This will allow the libfuzzer builders in https://chromium-review.googlesource.com/c/chromium/src/+/5474162 to succeed.

Bug: b/328065301
Change-Id: I97b401cb1b3339cfa7962f60b891be05baac75d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5479888
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Stephanie Kim <kimstephanie@google.com>
10 months ago
Brian Ryner 1a92126938 Delete vpython, leaving only vpython3.
Reland of https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5187892

Bug: 1376538
Change-Id: I6947cf2a54ec2b45b2540ad0784fafe73f44c441
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5343135
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Eli Ribble <eliribble@google.com>
Commit-Queue: Brian Ryner <bryner@google.com>
1 year ago
Rupert Wiser af6eabff53 Revert "Delete vpython, leaving only vpython3."
This reverts commit db0dcbbe7c.

Reason for revert: `gclient sync` no longer works on my local checkout with this change due to the error `No such file or directory: 'vpython'.`.

Original change's description:
> Delete vpython, leaving only vpython3.
>
> Bug: 1376538
> Change-Id: Ia7795f75fd05db63f155c5feffcc43822fb45bb1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5187892
> Reviewed-by: Mike Frysinger <vapier@chromium.org>
> Commit-Queue: Brian Ryner <bryner@google.com>
> Reviewed-by: George Engelbrecht <engeg@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Reviewed-by: Chenlin Fan <fancl@chromium.org>

Bug: 1376538
Change-Id: I7c32eea1f8ae07644ab81a35213de5c68c64dfb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5260042
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Brian Ryner <bryner@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
1 year ago
Brian Ryner db0dcbbe7c Delete vpython, leaving only vpython3.
Bug: 1376538
Change-Id: Ia7795f75fd05db63f155c5feffcc43822fb45bb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5187892
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Brian Ryner <bryner@google.com>
Reviewed-by: George Engelbrecht <engeg@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Chenlin Fan <fancl@chromium.org>
1 year ago
Gavin Mak f936d540e1 Remove __future__ imports
All __future__ imports (unicode_literals, print_function) are already
mandatory in py3. Also remove an outdated py2 comment in
presubmit_canned_checks.py

Bug: 1475402
Change-Id: I27cf6a8268f6dd1081f22af782c4c29a975376ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4867135
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
1 year ago
Junji Watanabe c5505889cf [gn] Fallback GN in PATH
This allows us to call GN outside of gclient checkout.
e.g PATH=$PATH:~/chromium/src/buildtools/linux64 gn

Change-Id: Ib4b6d09fbd4d3a12ea1407fcea0eb5494c808fb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4886535
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
1 year ago
Mike Frysinger 124bb8e53c switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.

Reformatted using:
files=( $(
	git ls-tree -r --name-only HEAD | \
		grep -Ev -e '^(third_party|recipes)/' | \
		grep '\.py$';
	git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"

The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py

Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Aravind Vasudevan c5f0cbb865 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Josip Sokcevic 42c5bbbc96 Revert "Use pylint 2.7 for depot_tools"
This reverts commit 22bf605bb6.

Reason for revert: breaks gclient sync

Original change's description:
> Use pylint 2.7 for depot_tools
>
> This includes a few fixes for specific errors, and disables several new
> warnings introduced in this version, in order to allow for an incremental migration.
>
> Bug:1262286
> Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>

Bug: 1262286
Change-Id: Ieb946073c7886c7bf056ce843a5a48e82becf7a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413672
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Aravind Vasudevan 22bf605bb6 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Mirko Bonadei ea4e399c4d Switch gn wrapper scripts to invoke python3.
Bug: 941669
Change-Id: I515459793f2a406a959c361f9884b183e21ebdf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2825439
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
4 years ago
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Nico Weber 09e0b38f0f Move gclient path access to separate module.
gclient_utils.py is a kitchen sink and is for that reason expensive
to import. Move the comparatively cheap and simple path routines
to a new gclient_paths module and use that in gn.py, clang_format.py,
dart_format.py.

(To be able to move FindGclientRoot() to gclient_paths.py,
make it use io.open() instead of FileRead(). FileRead() tries
to paper over invalid utf-8, but that was added for presubmits,
not for .gclient files, so this is hopefully fine.)

Cuts gn.py overhead in half (on my Windows laptop from 0.6s to 0.25s,
still high; on my Mac laptop from 0.1s to 0.05s), and probably helps
the other two too.

Completely remove PathDifference() since it's unused.

Bug: 939959
Change-Id: I6a70f6e4c16062b622fb2df8778e8a598d4cc956
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1512058
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Lowell Manners 4d2d5b4bbe Fix unhelpful error when gn.py run in wrong directory.
Before this change, when running gn.py outside of
the checkout, the error was:
AttributeError: 'NoneType' object has no attribute 'endswith'

R=scottmg@chromium.org
Bug: gn:14

Change-Id: I4f2f83b2a861bd6f9436c16c2c422fe18fab8f2a
Reviewed-on: https://chromium-review.googlesource.com/c/1299023
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Lowell Manners <lowell@google.com>
6 years ago
Sergiy Byelozyorov 01489553a0 Prune VirtualEnv's python from environment before running GN
This is neccessary to ensure that generated ninja commands invoke python from
PATH instead of the one from VPython's VirtualEnv. On LUCI builders that replace
system python with VPython using vpython:native-python-wrapper swarming tag, a
new VPython VirtualEnv bubble will be created for each script and contain that
script's individual dependencies.

Based on https://cs.chromium.org/chromium/infra/recipes-py/recipes.py?l=88&rcl=66d9d8c66f10ca37dffa4b6d374c3d802a061b01.

R=iannucci@chromium.org

Bug: 793687
Change-Id: I633d2e0dfeda0097072daba102fb013656aaafa2
Reviewed-on: https://chromium-review.googlesource.com/1120817
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Scott Graham a991ac69eb gn: Look in src for gn binaries before trying old buildtools location
Bug: 855791
Change-Id: I964df1a781da4335e9b77192faf7913d3546de13
Reviewed-on: https://chromium-review.googlesource.com/1112817
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
7 years ago
sbc@chromium.org 013731e832 Handle KeyboardInterrupt consistently in python scripts
Handle KeyboardInterrupt gracefully rather the printing a
backtrace. Most users of these tools don't expect a
backtrace when then hit Ctrl-C.

Also, fix a few other inconsistencies found in the python
startup code of these different scripts:
- always call main function 'main' (rather than 'Main')
- always return 0 from main function
- if main takes args never include argv[0]

Review URL: https://codereview.chromium.org/955993006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294250 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
scottmg@chromium.org d05ab35296 Add canned presubmit check for GN formatting
Requires https://codereview.chromium.org/779883002/ to be landed/rolled before it's useful.

R=dpranke@chromium.org
BUG=348474

Review URL: https://codereview.chromium.org/779513005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293269 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
kjellander@chromium.org f7facfab38 Make gn.py support root directories other than 'src'.
In https://codereview.chromium.org/341533006/ a change
was made so that gn.py is not looking for the .gn file
to identify the root of the checkout. This breaks
GN functionality for projects that uses gclient but
have a top directory named something else than 'src'.

This change adds support for arbitrarily named primary (the first)
solutions in the .gclient file.
It also adds a check for the generated GN path so a friendly
error message can be printed if the GN executable cannot be found.


BUG=389883
TESTED=Various cases of Chromium, WebRTC and custom checkouts
with .gclient containing empty solution list, solution missing the
'name' key and so on.

Review URL: https://codereview.chromium.org/538393002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291819 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
brettw@chromium.org cc968feb9a Make gn wrapper use the one in buildtools rather than tools/gn/bin.
This updates some infrastructure to make it easy to get at the platform-specific build tools directories.

Review URL: https://codereview.chromium.org/341533006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@279132 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
dpranke@chromium.org a2a0c576ef Fix the gn wrapper to be aware of the --root argument.
The gn binary itself is capable of being run from outside of a
checkout as long as you pass the --root flag.

However, the gn.py wrapper script needs to *also* know where the the
checkout is, in order to figure out how to find the gn binary itself.

This patch changes the wrapper to be aware of the --root arg :).

R=brettw@chromium.org
BUG=

Review URL: https://codereview.chromium.org/212173004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259998 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
nick@chromium.org 3ac1c4e320 Depot tools: use the clang-format binaries that are now included
as part of the Chromium checkout.

This follows the approach used by gn.

Changes include:
 - in-the-PATH clang-format trampoline scripts
 - clang_format.py, which finds clang-format binaries inside of Chrome
 - Hook 'git cl format' to the new binaries and scripts
 - Rearrange some code, for reuse between clang_format.py and gn.py

BUG=240309
TEST=presubmits (one failure on mac, but it fails on a clean checkout too)

Review URL: https://codereview.chromium.org/134313007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@245074 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
brettw@chromium.org 7d6ffa55da Detect cygwin as Win32 for the purposes of running GN and downloading from google storage.
This normalizes sys.platform so people running cygwin are treated like Windows.

Review URL: https://codereview.chromium.org/104763003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@238999 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
brettw@chromium.org 67bb861400 Add a wrapper script for GN to depot_tools
This automatically searches the path for a source root (or takes one from the
command line), and then executes the current platform's GN binary inside that
source tree.

This will allow the user to have a "gn" command on their path, and allow our
scripts to run GN without having to bake-in the logic for finding the correct
platform's GN binary.

Review URL: https://codereview.chromium.org/66013002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@233983 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago