diff options
author | Lei Zhang <thestig@chromium.org> | 2018-02-02 22:17:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-02 22:17:58 +0000 |
commit | b1d7872faacbd37c03eacc1e86214904db8f658f (patch) | |
tree | 077356465a88711a3755f3268b84a188d16f448f | |
parent | 2e988749a1775ff85b14d6e93a52c931481e64d3 (diff) | |
download | pdfium-b1d7872faacbd37c03eacc1e86214904db8f658f.tar.xz |
Teach the presubmit check to look for checkdeps in other places.chromium/3340chromium/3339chromium/3338
When PDFium source is not part of a standalone checkout, uploading CLs
fail because the presubmit check cannot find the checkdeps tool. Detect
the common case where PDFium is in third_party/pdfium, and look in the
embedder source tree for checkdeps.
BUG=pdfium:999
Change-Id: I972282aef9e62f99dce282d556ca2e68de3acbb0
Reviewed-on: https://pdfium-review.googlesource.com/24910
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
-rw-r--r-- | PRESUBMIT.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index a7db1230d4..ec0f0e4d9d 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -45,8 +45,21 @@ 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')] + def GenerateCheckdepsPath(base_path): + return input_api.os_path.join(base_path, 'buildtools', 'checkdeps') + + presubmit_path = input_api.PresubmitLocalPath() + presubmit_parent_path = input_api.os_path.dirname(presubmit_path) + not_standalone_pdfium = \ + input_api.os_path.basename(presubmit_parent_path) == "third_party" and \ + input_api.os_path.basename(presubmit_path) == "pdfium" + + sys.path.append(GenerateCheckdepsPath(presubmit_path)) + if not_standalone_pdfium: + presubmit_grandparent_path = input_api.os_path.dirname( + presubmit_parent_path) + sys.path.append(GenerateCheckdepsPath(presubmit_grandparent_path)) + import checkdeps from cpp_checker import CppChecker from rules import Rule |