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