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

Unified Diff: presubmit_canned_checks.py

Issue 12021013: Fix pylint presubmit check so that it works on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 11 months 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_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 90c79ccfcc6deda18a16bed8dfdc65d4848579e4..117167d6ec51688631c55b901d24fe459429c904 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -643,9 +643,16 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None,
# Only trigger if there is at least one python file affected.
def rel_path(regex):
"""Modifies a regex for a subject to accept paths relative to root."""
- if input_api.os_path.samefile(
- input_api.PresubmitLocalPath(), input_api.change.RepositoryRoot()):
- return regex
+ if hasattr(input_api.os_path, 'samefile'):
M-A Ruel 2013/01/18 16:31:46 Actually, it could be written shorter with: def s
chrisha 2013/01/18 16:52:12 And this is where it shows that I'm not really a P
+ if input_api.os_path.samefile(input_api.PresubmitLocalPath(),
+ input_api.change.RepositoryRoot()):
+ return regex
+ else:
+ # 'samefile' doesn't exist on Windows, so we fall back to an exact
+ # path match.
+ if (input_api.os_path.abspath(input_api.PresubmitLocalPath()) ==
+ input_api.os_path.abspath(input_api.change.RepositoryRoot())):
+ return regex
prefix = input_api.os_path.join(input_api.os_path.relpath(
input_api.PresubmitLocalPath(), input_api.change.RepositoryRoot()), '')
return input_api.re.escape(prefix) + regex
« 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