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

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: Fixes 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 | « tools/bisect-builds.py ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checkdeps/checkdeps.py
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py
index f4dee4166aecacf58708298f66fa5370b52e80d2..02d8d14554414c55725c8c56794924dcf52fd0e8 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.
@@ -91,6 +91,7 @@ BASE_DIRECTORY = ""
# The directories which contain the sources managed by git.
GIT_SOURCE_DIRECTORY = set()
+
# Specifies a single rule for an include, which can be either allow or disallow.
class Rule(object):
def __init__(self, allow, dir, source):
@@ -445,7 +446,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 +471,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 +493,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 +507,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())
« no previous file with comments | « tools/bisect-builds.py ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698