summaryrefslogtreecommitdiffstats
path: root/tools/checklicenses
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 17:25:34 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 17:25:34 +0000
commitcb155a802bdc49cfafea1c41e0f0a92168f1da09 (patch)
treebf0fae4855c7f4458d8e959455b9d12d6cd54d9d /tools/checklicenses
parent9bec23957253b83955c4096903ad6293d1c6e1bb (diff)
downloadchromium_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/checklicenses')
-rwxr-xr-xtools/checklicenses/checklicenses.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/checklicenses/checklicenses.py b/tools/checklicenses/checklicenses.py
index 4fd2c05..9b40d19 100755
--- a/tools/checklicenses/checklicenses.py
+++ b/tools/checklicenses/checklicenses.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.
@@ -411,7 +411,7 @@ PATH_SPECIFIC_WHITELISTED_LICENSES = {
}
-def main(options, args):
+def check_licenses(options, args):
# Figure out which directory we have to check.
if len(args) == 0:
# No directory to check specified, use the repository root.
@@ -423,7 +423,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:", options.base_directory
print "Checking:", start_dir
@@ -447,7 +447,7 @@ def main(options, args):
print stderr
print '--------- end licensecheck stderr ---------'
print "\nFAILED\n"
- sys.exit(1)
+ return 1
success = True
for line in stdout.splitlines():
@@ -484,7 +484,7 @@ def main(options, args):
if success:
print "\nSUCCESS\n"
- sys.exit(0)
+ return 0
else:
print "\nFAILED\n"
print "Please read",
@@ -493,11 +493,10 @@ def main(options, args):
print
print "Please respect OWNERS of checklicenses.py. Changes violating"
print "this requirement may be reverted."
+ return 1
- sys.exit(1)
-
-if '__main__' == __name__:
+def main():
default_root = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..'))
option_parser = optparse.OptionParser()
@@ -513,4 +512,8 @@ if '__main__' == __name__:
default=False,
help='Ignore path-specific license whitelist.')
options, args = option_parser.parse_args()
- main(options, args)
+ return check_licenses(options, args)
+
+
+if '__main__' == __name__:
+ sys.exit(main())