Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: PRESUBMIT.py

Issue 1464733002: During presubmit, look in parent directories for buildtools/checkdeps. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 459d3da755ed1706ab904c4349a2b6f65985759b..5dd22e25f0c522f3d199178e68252a5dd615d3f7 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):
Lei Zhang 2015/11/20 02:57:42 Well, in theory, /buildtools/checkdeps may contain
+ raise ImportError('Cannot find checkdeps')
+ checkdeps_basepath = input_api.os_path.dirname(checkdeps_basepath)
hans 2015/11/20 03:26:28 Sorry for being a little slow here.. how does this
Lei Zhang 2015/11/20 03:29:19 It's essentially: foo = os.path.dirname(foo) https
hans 2015/11/20 03:52:21 Ah, I get it now, thanks.
+ 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698