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

Unified Diff: chrome/tools/inconsistent-eol.py

Issue 8680018: Fix python scripts in src/chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 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 | « chrome/tools/history-viz.py ('k') | chrome/tools/process_dumps_linux.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/inconsistent-eol.py
diff --git a/chrome/tools/inconsistent-eol.py b/chrome/tools/inconsistent-eol.py
index 4ab35967f265f9d5e2459546b92289b6a6b839db..ef252459b615a65f3c586d336bb7c75e3b53c27a 100755
--- a/chrome/tools/inconsistent-eol.py
+++ b/chrome/tools/inconsistent-eol.py
@@ -1,5 +1,5 @@
-#!/usr/bin/python
-# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+#!/usr/bin/env python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -38,6 +38,7 @@ def CountChars(text, str):
logging.debug(len(split) - 1)
return len(split) - 1
+
def PrevailingEOLName(crlf, cr, lf):
"""Describe the most common line ending.
@@ -56,6 +57,7 @@ def PrevailingEOLName(crlf, cr, lf):
return 'crlf'
return 'lf'
+
def FixEndings(file, crlf, cr, lf):
"""Change the file's line endings to CRLF or LF, whichever is more common."""
most = max(crlf, cr, lf)
@@ -99,7 +101,8 @@ def ProcessFiles(filelist):
print '%s: mostly %s' % (filename, PrevailingEOLName(crlf, cr, lf))
FixEndings(filename, crlf, cr, lf)
-def main(options, args):
+
+def process(options, args):
"""Process the files."""
if not args or len(args) < 1:
raise Error('No files given.')
@@ -111,8 +114,10 @@ def main(options, args):
else:
filelist = args
ProcessFiles(filelist)
+ return 0
-if '__main__' == __name__:
+
+def main():
if DEBUGGING:
debug_level = logging.DEBUG
else:
@@ -131,5 +136,8 @@ if '__main__' == __name__:
default=False,
help="Force any files with CRLF to LF instead.")
options, args = option_parser.parse_args()
+ return process(options, args)
+
- sys.exit(main(options, args))
+if '__main__' == __name__:
+ sys.exit(main())
« no previous file with comments | « chrome/tools/history-viz.py ('k') | chrome/tools/process_dumps_linux.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698