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

Unified Diff: tools/checkdeps/checkdeps.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
Index: tools/checkdeps/checkdeps.py
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py
index f4dee4166aecacf58708298f66fa5370b52e80d2..b3c5acfa56982b8b538201982a5e239b2e0f699f 100755
--- a/tools/checkdeps/checkdeps.py
+++ b/tools/checkdeps/checkdeps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/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.
@@ -445,7 +445,8 @@ Examples:
python checkdeps.py
python checkdeps.py --root c:\\source chrome"""
-def main(options, args):
+
+def checkdeps(options, args):
global VERBOSE
if options.verbose:
VERBOSE = True
@@ -469,7 +470,7 @@ def main(options, args):
else:
# More than one argument, we don't handle this.
PrintUsage()
- sys.exit(1)
+ return 1
print "Using base directory:", BASE_DIRECTORY
print "Checking:", start_dir
@@ -491,11 +492,12 @@ def main(options, args):
success = CheckDirectory(base_rules, start_dir)
if not success:
print "\nFAILED\n"
- sys.exit(1)
+ return 1
print "\nSUCCESS\n"
- sys.exit(0)
+ return 0
-if '__main__' == __name__:
+
+def main():
option_parser = optparse.OptionParser()
option_parser.add_option("", "--root", default="", dest="base_directory",
help='Specifies the repository root. This defaults '
@@ -504,4 +506,8 @@ if '__main__' == __name__:
option_parser.add_option("-v", "--verbose", action="store_true",
default=False, help="Print debug logging")
options, args = option_parser.parse_args()
- main(options, args)
+ return checkdeps(options, args)
+
+
+if '__main__' == __name__:
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698