Commit 933d12e3 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

PRESUBMIT.py Fix a couple incorrect usages of f.LocalPath()

LocalPath() should be used in error messages, but never when actually
trying to access a path. For this, you should use AbsoluteLocalPath.

Bug: 768962
Change-Id: I28cd31ca71c24234813bd90bec2be0cffe416777
Reviewed-on: https://chromium-review.googlesource.com/744461Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512601}
parent e0c60a1b
...@@ -924,7 +924,7 @@ def _CheckFilePermissions(input_api, output_api): ...@@ -924,7 +924,7 @@ def _CheckFilePermissions(input_api, output_api):
args = [input_api.python_executable, checkperms_tool, args = [input_api.python_executable, checkperms_tool,
'--root', input_api.change.RepositoryRoot()] '--root', input_api.change.RepositoryRoot()]
for f in input_api.AffectedFiles(): for f in input_api.AffectedFiles():
args += ['--file', f.LocalPath()] args += ['--file', f.AbsoluteLocalPath()]
try: try:
input_api.subprocess.check_output(args) input_api.subprocess.check_output(args)
return [] return []
...@@ -2669,20 +2669,13 @@ def _CheckForWindowsLineEndings(input_api, output_api): ...@@ -2669,20 +2669,13 @@ def _CheckForWindowsLineEndings(input_api, output_api):
r'.+%s' % _IMPLEMENTATION_EXTENSIONS r'.+%s' % _IMPLEMENTATION_EXTENSIONS
) )
filter = lambda f: input_api.FilterSourceFile(
f, white_list=file_inclusion_pattern, black_list=None)
files = [f.LocalPath() for f in
input_api.AffectedSourceFiles(filter)]
problems = [] problems = []
source_file_filter = lambda f: input_api.FilterSourceFile(
for file in files: f, white_list=file_inclusion_pattern, black_list=None)
fp = open(file, 'r') for f in input_api.AffectedSourceFiles(source_file_filter):
for line in fp: for line_number, line in f.ChangedContents():
if line.endswith('\r\n'): if line.endswith('\r\n'):
problems.append(file) problems.append(f.LocalPath())
break
fp.close()
if problems: if problems:
return [output_api.PresubmitPromptWarning('Are you sure that you want ' return [output_api.PresubmitPromptWarning('Are you sure that you want '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment