Skip to content

Commit aefe61a

Browse files
author
kjellander@webrtc.org
committed
PRESUBMIT: Add check for checkdeps.
Several times I've run into the problem with presubmit crashing when uploading a CL from a checkout where gclient sync hasn't run yet. This will print a user friendly error message instead. BUG= R=phoglund@webrtc.org Review URL: https://webrtc-codereview.appspot.com/32699004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7824 4adac7df-926f-26a2-2b94-8c16560cd09d
1 parent 7db359b commit aefe61a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

PRESUBMIT.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# in the file PATENTS. All contributing project authors may
77
# be found in the AUTHORS file in the root of the source tree.
88

9+
import os
910
import re
1011
import sys
1112

@@ -152,8 +153,13 @@ def _CheckUnwantedDependencies(input_api, output_api):
152153
# eval-ed and thus doesn't have __file__.
153154
original_sys_path = sys.path
154155
try:
155-
sys.path = sys.path + [input_api.os_path.join(
156-
input_api.PresubmitLocalPath(), 'buildtools', 'checkdeps')]
156+
checkdeps_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
157+
'buildtools', 'checkdeps')
158+
if not os.path.exists(checkdeps_path):
159+
return [output_api.PresubmitError(
160+
'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
161+
'download Chromium and setup the symlinks?' % checkdeps_path)]
162+
sys.path.append(checkdeps_path)
157163
import checkdeps
158164
from cpp_checker import CppChecker
159165
from rules import Rule

0 commit comments

Comments
 (0)