Look for both new and old paths when checking the buildtools/ dir.
Currently, there's different binaries for mac x64 and mac arm64.
Depending on the host cpu, only one is downloaded to buildtools/mac,
meaning that there is an overlap in buildtools/mac.
When we migrate to clang-format, buildtools/mac will be for mac x64
and buildtools/mac_arm64 will be for mac arm64.
- Verified locally on my macbook that the mac_arm64 path correctly
gets chosen.
Migration CL: https://chromium-review.googlesource.com/c/chromium/src/+/5484590
Bug: b/336843583,
Change-Id: I26f80dff0e39b7ae31ed5d0a1d8e436eb19fbb3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5484138
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Stephanie Kim <kimstephanie@google.com>
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>
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>
This change looks for clang-format (and its script) *also*
inside third_party/clang-format (on top of buildtools/$plat).
This is to bring consistency to the recent changes [1] to
gn and ninja wrappers, which now look only in third_party
and not in buildtools/.
This is to make it so that a project can use depot_tools
without requiring both buildtools/ and third_party/
directories.
[1] See https://crrev.com/c/3925341
Bug: b/261398524
Bug: 1340825
Change-Id: I895d244592eed259ab8efa050cc87372d891246c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4079069
Commit-Queue: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
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>
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>
Its useful to be able to run clang-format on projects
outside of chromium. This change informs developers
how they can do that.
Change-Id: I01ef755aa6e5b53a0a5bb6377e92b2ffdfd17eff
Reviewed-on: https://chromium-review.googlesource.com/414204
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Sam Clegg <sbc@chromium.org>
Passing arg[1] rather than argv[1:] is causing the following with
Python 2.7.3.
Traceback (most recent call last):
File "/home/tfarina/depot_tools/clang_format.py", line 70, in
<module>
sys.exit(main(sys.argv[1]))
File "/home/tfarina/depot_tools/clang_format.py", line 65,
in main
return subprocess.call([tool] + args)
TypeError: can only concatenate list (not "str") to list
No output from clang-format (crashed?).
Please report to bugs.llvm.org.
This started to happening after
http://src.chromium.org/viewvc/chrome?view=rev&revision=294250
BUG=None
TEST=try to format a c++ file using clang-format
TBR=sbc@chromium.org,maruel@chromium.org
Review URL: https://codereview.chromium.org/972453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294267 0039d316-1c4b-4281-b951-d872f2087c98
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
Use the source root (src/ in Chromium) rather than the checkout root as
the path from which to locate the clang-format binaries.
webrtc uses the Chromium build/tools infrastructure but doesn't have
src/ as a source root path. This change allows us to continue to use
'git cl format' in a standalone webrtc checkout (which would be nice.)
BUG=240309
TESTED='git cl format' works on a trivial test change in both a
Chromium and webrtc checkout.
Review URL: https://codereview.chromium.org/135653014
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@248651 0039d316-1c4b-4281-b951-d872f2087c98
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