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
This commit is contained in:
10
PRESUBMIT.py
10
PRESUBMIT.py
@@ -6,6 +6,7 @@
|
|||||||
# in the file PATENTS. All contributing project authors may
|
# in the file PATENTS. All contributing project authors may
|
||||||
# be found in the AUTHORS file in the root of the source tree.
|
# be found in the AUTHORS file in the root of the source tree.
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -152,8 +153,13 @@ def _CheckUnwantedDependencies(input_api, output_api):
|
|||||||
# eval-ed and thus doesn't have __file__.
|
# eval-ed and thus doesn't have __file__.
|
||||||
original_sys_path = sys.path
|
original_sys_path = sys.path
|
||||||
try:
|
try:
|
||||||
sys.path = sys.path + [input_api.os_path.join(
|
checkdeps_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
|
||||||
input_api.PresubmitLocalPath(), 'buildtools', 'checkdeps')]
|
'buildtools', 'checkdeps')
|
||||||
|
if not os.path.exists(checkdeps_path):
|
||||||
|
return [output_api.PresubmitError(
|
||||||
|
'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
|
||||||
|
'download Chromium and setup the symlinks?' % checkdeps_path)]
|
||||||
|
sys.path.append(checkdeps_path)
|
||||||
import checkdeps
|
import checkdeps
|
||||||
from cpp_checker import CppChecker
|
from cpp_checker import CppChecker
|
||||||
from rules import Rule
|
from rules import Rule
|
||||||
|
Reference in New Issue
Block a user