diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 17:25:34 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-29 17:25:34 +0000 |
commit | cb155a802bdc49cfafea1c41e0f0a92168f1da09 (patch) | |
tree | bf0fae4855c7f4458d8e959455b9d12d6cd54d9d /tools/checkdeps | |
parent | 9bec23957253b83955c4096903ad6293d1c6e1bb (diff) | |
download | chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.zip chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.tar.gz chromium_src-cb155a802bdc49cfafea1c41e0f0a92168f1da09.tar.bz2 |
Fix python scripts in src/tools/
Make sure that:
- shebang is only present for executable files
- shebang is #!/usr/bin/env python
- __main__ is only present for executable files
- file's executable bit is coherent
Also fix EOF LF to be only one.
TBR=timurrrr@chromium.org
BUG=105108
TEST=
Review URL: http://codereview.chromium.org/8678023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/checkdeps')
-rwxr-xr-x | tools/checkdeps/checkdeps.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py index f4dee41..02d8d14 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()) |