summaryrefslogtreecommitdiff
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-19 21:37:43 -0800
committerLei Zhang <thestig@chromium.org>2015-11-19 21:37:43 -0800
commit814000d7876df07a03a320f9eae8af5da7b340c5 (patch)
treea7768aa0a27d42974760ac8e613082fb1a91e403 /PRESUBMIT.py
parent06e33aec03f13c76d9eff5c09cb03e142b0c5ef1 (diff)
downloadpdfium-814000d7876df07a03a320f9eae8af5da7b340c5.tar.xz
During presubmit, look in parent directories for buildtools/checkdeps.
This may be useful when PDFium is not a standalone checkout. R=hans@chromium.org Review URL: https://codereview.chromium.org/1464733002 .
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 459d3da755..5dd22e25f0 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -19,8 +19,18 @@ def _CheckUnwantedDependencies(input_api, output_api):
# eval-ed and thus doesn't have __file__.
original_sys_path = sys.path
try:
- sys.path = sys.path + [input_api.os_path.join(
- input_api.PresubmitLocalPath(), 'buildtools', 'checkdeps')]
+ checkdeps_relpath = input_api.os_path.join('buildtools', 'checkdeps')
+ checkdeps_basepath = input_api.PresubmitLocalPath()
+ checkdeps_path = input_api.os_path.join(checkdeps_basepath,
+ checkdeps_relpath)
+ while not input_api.os_path.exists(checkdeps_path):
+ if checkdeps_basepath == input_api.os_path.dirname(checkdeps_basepath):
+ raise ImportError('Cannot find checkdeps')
+ checkdeps_basepath = input_api.os_path.dirname(checkdeps_basepath)
+ checkdeps_path = input_api.os_path.join(checkdeps_basepath,
+ checkdeps_relpath)
+
+ sys.path.append(checkdeps_path)
import checkdeps
from cpp_checker import CppChecker
from rules import Rule