Fix presubmit_support.py to handle CRLF in PRESUBMIT.py
PRESUBMIT.py files should not have CRLF line endings, but if a git repo is misconfigured this may happen and it is important for the presubmits to run properly so that they can report on this issue. In particular, the regex which detects USE_PYTHON3 = True did not work with CRLF line endings. It was supposed to handle these, and there is even a comment saying: # Accept CRLF presubmit script. However the line after that uses 'rU' as the file open mode in order to try to get universal newlines, but FileRead ignores the file mode. So, the replace method is now used instead. Bug: angleproject:7475, angleproject:4905 Change-Id: I38321176feca089a5796b24756b371709d852243 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3739269Reviewed-by: Eddie Hatfield <eddiehatfield@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Showing
Please
register
or
sign in
to comment