This allows repo to be symlinked in the workspace and gclient config is
pointing to the symlink. For example, if repo is checked out at
`${WS}/chromium`, a symlink is created from `${WS}/src` and ${WS}/.gclient
is pointing to `${WS}/src`, when the code is trying to determine the
gclient root with cwd=`${WS}/chromium/XXX/XXX`, the code won't treat ${WS}
as the workspace root. Because .gclient_entries all started with `src/`
and `${WS}/chromium/XXX/XXX` won't match anything in .gclient_entries.
The fix here is to calculate the realpath (i.e. resolving the symlink)
for all paths in .gclient_entries and path_to_check before comparison.
Change-Id: I914ba5a7131588fa99d6900ada954f3694dda197
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5656593
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Several clients of this module call its methods repeatedly. Cache them
to speed them up.
E.g. "autosiso" calls FindGclientRoot() 5 times before building
E.g. "git cl format" calls it 5 times in one of my CLs.
Bug: None
Change-Id: I70995c2def9689d46a89896640cc748d9629df3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4904697
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
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.
Bug: 1475402
Change-Id: I17174d7252b5cbf698700333d3cd561c6591d0a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809190
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
In GetPrimarySolutionPath(), redirect the stderr of the
git rev-parse --show-toplevel command to /dev/null. This avoids the
following error message when running depot_tools' ninja command outside
the Chrome source tree:
fatal: not a git repository (or any of the parent directories): .git
I believe this error message was an unintended side effect of the work
on bug 1340825.
Bug: 1340825
Change-Id: I5679a854d1ff23f581564c54c765e13f8ba8b534
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4392154
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
os.path.realpath will resolve back to the subst paths, leading to
inappropriate current working directories for all downstream hooks.
BUG=1208688
Change-Id: Idfcb0fe4d25ab1317db5aae34663b1017d4c4937
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2893669
Commit-Queue: Dirk Pranke <dpranke@google.com>
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
CheckCallAndFilter isn't part of the global namespace, and as a result,
this call was silently failing.
BUG=1007553
Change-Id: Ie2f3135fc3d56be189d8be0fe996a068e0645705
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1823664
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Robert Liao <robliao@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>
sys takes essentially no time to import (I think possibly because
it's a built-in?), and importing it as-needed is fragile. Make
it a top-level import to gclient_paths to prevent future breakages.
BUG=939959
Change-Id: I1ebe1260afd927355d668acf3cab5067ff0a2e03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1515669
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
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>