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>
python3 is the only supported version of python in depot_tools.
Remove py2 support from files including:
* cpplint.py
* subprocess2.py
* many tests and testing_support files
Bug: 1475402
Change-Id: I67a98188bc13c4dc119e6158a37bd236bfd6ea70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4824474
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
subprocess.DEVNULL was introduced in Python3 to serve same purpose
as subprocess2.VOID, so rename VOID to DEVNULL in subprocess2.
Change-Id: I6dade3306ffc3bc2441ac6083f362b099c2427e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587758
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
stdout and stderr are bytes in Python 3 and must be decoded before
printing the exception.
Bug: 1060409
Change-Id: Ib855f6104919734b7505aa5e978ebe394a1e9db6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2097595
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
SIGKILL doesn't exist on Windows, but SIGTERM does.
For our purposes they do the same thing.
Bug: 962263
Change-Id: I16929cf7d1377cd81f71401a48b5a84fe54da493
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1608561
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Since Python 3 it must be "utf-8", which is the official name.
This is backwards compatible with Python 2.
Bug: 962277
Change-Id: I21115a322944532f1870862c8c048f8455c1109f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1608562
Auto-Submit: Raul Tambre <raul@tambre.ee>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
A previous CL replaced "basestring" with "str", because basestring
does not exist in Python 3. However, this broke Python 2's ability
to interoperate with unicode strings. This CL introduces a workaround
(defining basestring to be equivalent to string, if it doesn't exist
already), and restores the references to basestring. This workaround
can be fixed when we're 100% on Python 3.
It also undoes some unnecessary and harder-to-read formatting changes.
Bug: 942522
Change-Id: I4a31ee46dc048134c2e4832b6c44ea00ce341899
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1572441
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
This is a speculative fix for subprocess being unable to find
string-escape later in execution; the theory being that something
(unclear what) is interfering w/ codecs' lookup logic and that calling
lookup earlier would allow string-escape to be cached before any such
interference. See crbug.com/912292#c2 for more.
Bug: 912292
Change-Id: I0abdd394253c9a4984db7c6c81d044087edc68fd
Reviewed-on: https://chromium-review.googlesource.com/c/1363753
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.
The purpose is to slightly improve readability of pylint
disable comments.
Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
There's a race condition in python's subprocess module, and gclient uses
it heavily while multithreaded. Avoid the race by locking around calls
to subprocess.Popen's constructor. Detailed explanation in the bug.
BUG=531561
Review URL: https://codereview.chromium.org/1343783004
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296685 0039d316-1c4b-4281-b951-d872f2087c98
Allows the command line itself to be distinguished
from the surrounding error message.
Review URL: https://codereview.chromium.org/1152443004
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295481 0039d316-1c4b-4281-b951-d872f2087c98
According to Python's doc (
https://docs.python.org/2/library/subprocess.html#subprocess.check_output
):
if check_output raises exception CalledProcessError, the exception object
should contain stdout data as `output` attribute. Before this commit,
subprocess2.CalledProcessError had `output` always None, and used `stdout`
instead. This commit fixes this problem storing the same data in both `stdout`
and `output`.
BUG=NONE
Review URL: https://codereview.chromium.org/582933002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292036 0039d316-1c4b-4281-b951-d872f2087c98
When running an executable fails, the original error message sent by
the OS is printed, together with a more detailed suggested solution.
BUG=
Review URL: https://codereview.chromium.org/245133003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@266908 0039d316-1c4b-4281-b951-d872f2087c98
Also, increase the wait for socket binding to 0.2 seconds because OSX10.6 is
broken _and_ slow.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8749005
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@112277 0039d316-1c4b-4281-b951-d872f2087c98
This makes sure no regression relative to subprocess is introduced in
subprocess2.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8722001
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@112217 0039d316-1c4b-4281-b951-d872f2087c98
This will be necessary to override member functions eventually. It also better
replicates what subprocess.Popen is.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8570005
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@111530 0039d316-1c4b-4281-b951-d872f2087c98
Change return value from list to tuple for communicate(timeout != None).
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8539015
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@110094 0039d316-1c4b-4281-b951-d872f2087c98
"Add callback support for stdout and stderr."
"Add tests for both universal_newlines=True and False."
"Implement accelerated tee support for POSIX."
The reason is that the semantic of
subprocess2.check_call(cmd, timeout=60, stderr=subprocess2.STDOUT) changed,
stderr wasn't redirected to VOID anymore and for an unknown reason, it was
hanging until the timeout happened. Will reapply r109239 with a new regression
test to detect that bug.
TBR=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8505046
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@109369 0039d316-1c4b-4281-b951-d872f2087c98
This removes all the need of threading, which removes the contention on the GIL
lock.
Taking S2Test.test_check_output_tee_large as baseline, numbers are
real/user/sys in seconds:
Ubuntu workstation: ~25x 2.4/1.9/1.5 -> 0.10/0.70/0.02
OSX 10.6 laptop: ~40x 6.4/5.3/3.9 -> 0.15/0.80/0.07
Cygwin on win7: ~4x 2.8/2.2/1.3 -> 0.60/0.16/0.30
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8462008
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@109283 0039d316-1c4b-4281-b951-d872f2087c98
It's currently an inefficient thread implementation. Interestingly
enough, callback support is significantly faster on cygwin than on
native python.
Writing an efficient implementation is punted for a later change,
one per implementation.
Stops using a temporary file since it's not necessary anymore.
The goal is to reduce the number of places where a similar paradigm
is used by having a canonical generic implementation.
R=dpranke@chromium.org
BUG=
TEST=Tested manually on Windows, cygwin, linux, OSX 10.6
Review URL: http://codereview.chromium.org/8374026
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@109239 0039d316-1c4b-4281-b951-d872f2087c98
stderr is not redirected by default. stdout is not allowed.
Both were oversight.
Do not override stdin=None in case the user would response to stderr output for
example.
Increase test coverage.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/7860041
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@100456 0039d316-1c4b-4281-b951-d872f2087c98
Rename check_call to check_call_out. It's a quite specific need when stderr is
needed or when the user doesn't want the default arguments of check_output.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/6882127
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@83023 0039d316-1c4b-4281-b951-d872f2087c98
Since no output is user visible anyway, causing a hang with no clue about what
to type in.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/6823091
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@81302 0039d316-1c4b-4281-b951-d872f2087c98
Also fix a few issues found along the way.
Tests had regressed a lot. Add a lot of tweaks to make most test pass.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/6792060
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80618 0039d316-1c4b-4281-b951-d872f2087c98