summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/PRESUBMIT.py1
-rwxr-xr-x[-rw-r--r--]chrome_frame/combine_libs.py6
-rwxr-xr-x[-rw-r--r--]chrome_frame/tools/helper_shutdown.py12
-rwxr-xr-x[-rw-r--r--]chrome_frame/tools/smoke_test.py8
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py9
-rw-r--r--jingle/PRESUBMIT.py1
-rwxr-xr-xprinting/cups_config_helper.py73
-rwxr-xr-xremoting/tools/gettoken.py104
-rwxr-xr-xremoting/tools/register_host.py146
-rwxr-xr-xremoting/tools/runclient.py93
-rwxr-xr-x[-rw-r--r--]remoting/webapp/build-webapp.py7
-rwxr-xr-xremoting/webapp/verify-translations.py16
-rwxr-xr-xremoting/webapp/verify-webapp.py8
-rwxr-xr-x[-rw-r--r--]testing/generate_gmock_mutant.py9
-rwxr-xr-x[-rw-r--r--]ui/gfx/gl/generate_bindings.py13
-rwxr-xr-xviews/PRESUBMIT.py3
16 files changed, 281 insertions, 228 deletions
diff --git a/base/PRESUBMIT.py b/base/PRESUBMIT.py
index 1284659..459751e 100644
--- a/base/PRESUBMIT.py
+++ b/base/PRESUBMIT.py
@@ -1,4 +1,3 @@
-#!/usr/bin/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.
diff --git a/chrome_frame/combine_libs.py b/chrome_frame/combine_libs.py
index 5a2efec..8f2380c 100644..100755
--- a/chrome_frame/combine_libs.py
+++ b/chrome_frame/combine_libs.py
@@ -1,4 +1,5 @@
-# Copyright (c) 2010 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.
@@ -108,7 +109,8 @@ def Main():
del os.environ['VS_UNICODE_OUTPUT']
CombineLibraries(output, remove_re, args)
+ return 0
if __name__ == '__main__':
- Main()
+ sys.exit(Main())
diff --git a/chrome_frame/tools/helper_shutdown.py b/chrome_frame/tools/helper_shutdown.py
index 770adda..a818808 100644..100755
--- a/chrome_frame/tools/helper_shutdown.py
+++ b/chrome_frame/tools/helper_shutdown.py
@@ -1,14 +1,18 @@
-# Copyright (c) 2010 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.
-'''This is a simple helper script to shut down the Chrome Frame helper process.
-It needs the Python Win32 extensions.'''
+"""This is a simple helper script to shut down the Chrome Frame helper process.
+
+Requires Python Win32 extensions.
+"""
import pywintypes
import sys
import win32gui
import win32con
+
def main():
exit_code = 0
window = win32gui.FindWindow('ChromeFrameHelperWindowClass',
@@ -23,8 +27,8 @@ def main():
print 'Failed to shutdown Chrome Frame helper process: '
print ex
exit_code = 1
-
return exit_code
+
if __name__ == '__main__':
sys.exit(main())
diff --git a/chrome_frame/tools/smoke_test.py b/chrome_frame/tools/smoke_test.py
index f28d0a6..bc8959e 100644..100755
--- a/chrome_frame/tools/smoke_test.py
+++ b/chrome_frame/tools/smoke_test.py
@@ -1,9 +1,11 @@
-# Copyright (c) 2010 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.
-'''This script builds and runs the Chrome Frame unit and integration tests,
+"""Builds and runs the Chrome Frame unit and integration tests,
the exit status of the scrip is the number of failed tests.
-'''
+"""
+
import os.path
import sys
import win32com.client
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 7d00e42..9bad3ed 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1,5 +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.
@@ -5992,7 +5991,9 @@ def main(argv):
if gen.errors > 0:
print "%d errors" % gen.errors
- sys.exit(1)
+ return 1
+ return 0
+
if __name__ == '__main__':
- main(sys.argv[1:])
+ sys.exit(main(sys.argv[1:]))
diff --git a/jingle/PRESUBMIT.py b/jingle/PRESUBMIT.py
index 7039952..2ed4998 100644
--- a/jingle/PRESUBMIT.py
+++ b/jingle/PRESUBMIT.py
@@ -1,4 +1,3 @@
-#!/usr/bin/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.
diff --git a/printing/cups_config_helper.py b/printing/cups_config_helper.py
index 3c1dd41..3fe5fe0 100755
--- a/printing/cups_config_helper.py
+++ b/printing/cups_config_helper.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.
@@ -20,39 +20,48 @@ import subprocess
import sys
def usage():
- print 'usage: %s {--cflags|--ldflags|--libs}' % sys.argv[0]
- sys.exit(1)
+ print 'usage: %s {--cflags|--ldflags|--libs}' % sys.argv[0]
+
def run_cups_config(mode):
- """Run cups-config with all --cflags etc modes, parse out the mode we want,
- and return those flags as a list."""
-
- cups = subprocess.Popen(['cups-config', '--cflags', '--ldflags', '--libs'],
- stdout=subprocess.PIPE)
- flags = cups.communicate()[0].strip()
-
- flags_subset = []
- for flag in flags.split():
- flag_mode = None
- if flag.startswith('-l'):
- flag_mode = '--libs'
- elif (flag.startswith('-L') or flag.startswith('-Wl,')):
- flag_mode = '--ldflags'
- elif (flag.startswith('-I') or flag.startswith('-D')):
- flag_mode = '--cflags'
-
- # Be conservative: for flags where we don't know which mode they
- # belong in, always include them.
- if flag_mode is None or flag_mode == mode:
- flags_subset.append(flag)
-
- return flags_subset
-
-if len(sys.argv) != 2:
+ """Run cups-config with all --cflags etc modes, parse out the mode we want,
+ and return those flags as a list."""
+
+ cups = subprocess.Popen(['cups-config', '--cflags', '--ldflags', '--libs'],
+ stdout=subprocess.PIPE)
+ flags = cups.communicate()[0].strip()
+
+ flags_subset = []
+ for flag in flags.split():
+ flag_mode = None
+ if flag.startswith('-l'):
+ flag_mode = '--libs'
+ elif (flag.startswith('-L') or flag.startswith('-Wl,')):
+ flag_mode = '--ldflags'
+ elif (flag.startswith('-I') or flag.startswith('-D')):
+ flag_mode = '--cflags'
+
+ # Be conservative: for flags where we don't know which mode they
+ # belong in, always include them.
+ if flag_mode is None or flag_mode == mode:
+ flags_subset.append(flag)
+
+ return flags_subset
+
+
+def main():
+ if len(sys.argv) != 2:
usage()
+ return 1
-mode = sys.argv[1]
-if mode not in ('--cflags', '--libs', '--ldflags'):
+ mode = sys.argv[1]
+ if mode not in ('--cflags', '--libs', '--ldflags'):
usage()
-flags = run_cups_config(mode)
-print ' '.join(flags)
+ return 1
+ flags = run_cups_config(mode)
+ print ' '.join(flags)
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/remoting/tools/gettoken.py b/remoting/tools/gettoken.py
index a36408b..4f867bf 100755
--- a/remoting/tools/gettoken.py
+++ b/remoting/tools/gettoken.py
@@ -1,11 +1,12 @@
#!/usr/bin/env python
-#
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
-#
-# gettoken.py can be used to get auth token from Gaia. It asks username and
-# password and then prints token on the screen.
+
+"""Get auth token from Gaia.
+
+It asks username and password and then prints token on the screen.
+"""
import getpass
import os
@@ -13,46 +14,53 @@ import urllib
import gaia_auth
-chromoting_auth_filepath = os.path.join(os.path.expanduser('~'),
- '.chromotingAuthToken')
-chromoting_dir_auth_filepath = os.path.join(os.path.expanduser('~'),
- '.chromotingDirectoryAuthToken')
-
-print "Email:",
-email = raw_input()
-
-passwd = getpass.getpass("Password: ")
-
-chromoting_authenticator = gaia_auth.GaiaAuthenticator('chromiumsync');
-chromoting_auth_token = chromoting_authenticator.authenticate(email, passwd)
-
-chromoting_dir_authenticator = gaia_auth.GaiaAuthenticator('chromoting');
-chromoting_dir_auth_token = \
- chromoting_dir_authenticator.authenticate(email, passwd)
-
-# Set permission mask for created files.
-os.umask(0066)
-
-chromoting_auth_file = open(chromoting_auth_filepath, 'w')
-chromoting_auth_file.write(email)
-chromoting_auth_file.write('\n')
-chromoting_auth_file.write(chromoting_auth_token)
-chromoting_auth_file.close()
-
-print
-print 'Chromoting (sync) Auth Token:'
-print
-print chromoting_auth_token
-print '...saved in', chromoting_auth_filepath
-
-chromoting_dir_auth_file = open(chromoting_dir_auth_filepath, 'w')
-chromoting_dir_auth_file.write(email)
-chromoting_dir_auth_file.write('\n')
-chromoting_dir_auth_file.write(chromoting_dir_auth_token)
-chromoting_dir_auth_file.close()
-
-print
-print 'Chromoting Directory Auth Token:'
-print
-print chromoting_dir_auth_token
-print '...saved in', chromoting_dir_auth_filepath
+
+def main():
+ basepath = os.path.expanduser('~')
+ chromoting_auth_filepath = os.path.join(basepath, '.chromotingAuthToken')
+ chromoting_dir_auth_filepath = os.path.join(
+ basepath, '.chromotingDirectoryAuthToken')
+
+ print "Email:",
+ email = raw_input()
+
+ passwd = getpass.getpass("Password: ")
+
+ chromoting_authenticator = gaia_auth.GaiaAuthenticator('chromiumsync');
+ chromoting_auth_token = chromoting_authenticator.authenticate(email, passwd)
+
+ chromoting_dir_authenticator = gaia_auth.GaiaAuthenticator('chromoting');
+ chromoting_dir_auth_token = chromoting_dir_authenticator.authenticate(
+ email, passwd)
+
+ # Set permission mask for created files.
+ os.umask(0066)
+
+ chromoting_auth_file = open(chromoting_auth_filepath, 'w')
+ chromoting_auth_file.write(email)
+ chromoting_auth_file.write('\n')
+ chromoting_auth_file.write(chromoting_auth_token)
+ chromoting_auth_file.close()
+
+ print
+ print 'Chromoting (sync) Auth Token:'
+ print
+ print chromoting_auth_token
+ print '...saved in', chromoting_auth_filepath
+
+ chromoting_dir_auth_file = open(chromoting_dir_auth_filepath, 'w')
+ chromoting_dir_auth_file.write(email)
+ chromoting_dir_auth_file.write('\n')
+ chromoting_dir_auth_file.write(chromoting_dir_auth_token)
+ chromoting_dir_auth_file.close()
+
+ print
+ print 'Chromoting Directory Auth Token:'
+ print
+ print chromoting_dir_auth_token
+ print '...saved in', chromoting_dir_auth_filepath
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/remoting/tools/register_host.py b/remoting/tools/register_host.py
index ffdb955..6530d0e 100755
--- a/remoting/tools/register_host.py
+++ b/remoting/tools/register_host.py
@@ -1,11 +1,12 @@
#!/usr/bin/env python
-#
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
-#
-# register_host.py registers new hosts in chromoting directory. It
-# asks for username/password and then writes these settings to config file.
+
+"""Registers new hosts in chromoting directory.
+
+It asks for username/password and then writes these settings to config file.
+"""
import getpass
import os
@@ -22,67 +23,74 @@ def random_uuid():
return ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x" %
tuple(map(lambda x: random.randrange(0,65536), range(8))))
-server = 'www.googleapis.com'
-url = 'https://' + server + '/chromoting/v1/@me/hosts'
-
-settings_filepath = os.path.join(os.path.expanduser('~'),
- '.ChromotingConfig.json')
-
-print "Email:",
-email = raw_input()
-password = getpass.getpass("Password: ")
-
-chromoting_auth = gaia_auth.GaiaAuthenticator('chromoting')
-auth_token = chromoting_auth.authenticate(email, password)
-
-host_id = random_uuid()
-print "HostId:", host_id
-host_name = socket.gethostname()
-print "HostName:", host_name
-
-print "Generating RSA key pair...",
-(private_key, public_key) = keygen.generateRSAKeyPair()
-print "Done"
-
-params = ('{"data":{' + \
- '"hostId": "%(hostId)s",' + \
- '"hostName": "%(hostName)s",' + \
- '"publicKey": "%(publicKey)s"}}') % \
- {'hostId': host_id, 'hostName': host_name,
- 'publicKey': public_key}
-headers = {"Authorization": "GoogleLogin auth=" + auth_token,
- "Content-Type": "application/json" }
-request = urllib2.Request(url, params, headers)
-
-opener = urllib2.OpenerDirector()
-opener.add_handler(urllib2.HTTPDefaultErrorHandler())
-
-print
-print "Registering host with directory service..."
-try:
- res = urllib2.urlopen(request)
- data = res.read()
-except urllib2.HTTPError, err:
- print >> sys.stderr, "Directory returned error:", err
- print >> sys.stderr, err.fp.read()
- sys.exit(1)
-
-print "Done"
-
-# Get token that the host will use to athenticate in talk network.
-authenticator = gaia_auth.GaiaAuthenticator('chromiumsync');
-auth_token = authenticator.authenticate(email, password)
-
-# Write settings file.
-os.umask(0066) # Set permission mask for created file.
-settings_file = open(settings_filepath, 'w')
-settings_file.write('{\n');
-settings_file.write(' "xmpp_login" : "' + email + '",\n')
-settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n')
-settings_file.write(' "host_id" : "' + host_id + '",\n')
-settings_file.write(' "host_name" : "' + host_name + '",\n')
-settings_file.write(' "private_key" : "' + private_key + '",\n')
-settings_file.write('}\n')
-settings_file.close()
-
-print 'Configuration saved in', settings_filepath
+
+def main():
+ server = 'www.googleapis.com'
+ url = 'https://' + server + '/chromoting/v1/@me/hosts'
+
+ settings_filepath = os.path.join(os.path.expanduser('~'),
+ '.ChromotingConfig.json')
+
+ print "Email:",
+ email = raw_input()
+ password = getpass.getpass("Password: ")
+
+ chromoting_auth = gaia_auth.GaiaAuthenticator('chromoting')
+ auth_token = chromoting_auth.authenticate(email, password)
+
+ host_id = random_uuid()
+ print "HostId:", host_id
+ host_name = socket.gethostname()
+ print "HostName:", host_name
+
+ print "Generating RSA key pair...",
+ (private_key, public_key) = keygen.generateRSAKeyPair()
+ print "Done"
+
+ params = ('{"data":{' +
+ '"hostId": "%(hostId)s",' +
+ '"hostName": "%(hostName)s",' +
+ '"publicKey": "%(publicKey)s"}}') %
+ {'hostId': host_id, 'hostName': host_name,
+ 'publicKey': public_key}
+ headers = {"Authorization": "GoogleLogin auth=" + auth_token,
+ "Content-Type": "application/json" }
+ request = urllib2.Request(url, params, headers)
+
+ opener = urllib2.OpenerDirector()
+ opener.add_handler(urllib2.HTTPDefaultErrorHandler())
+
+ print
+ print "Registering host with directory service..."
+ try:
+ res = urllib2.urlopen(request)
+ data = res.read()
+ except urllib2.HTTPError, err:
+ print >> sys.stderr, "Directory returned error:", err
+ print >> sys.stderr, err.fp.read()
+ return 1
+
+ print "Done"
+
+ # Get token that the host will use to athenticate in talk network.
+ authenticator = gaia_auth.GaiaAuthenticator('chromiumsync');
+ auth_token = authenticator.authenticate(email, password)
+
+ # Write settings file.
+ os.umask(0066) # Set permission mask for created file.
+ settings_file = open(settings_filepath, 'w')
+ settings_file.write('{\n');
+ settings_file.write(' "xmpp_login" : "' + email + '",\n')
+ settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n')
+ settings_file.write(' "host_id" : "' + host_id + '",\n')
+ settings_file.write(' "host_name" : "' + host_name + '",\n')
+ settings_file.write(' "private_key" : "' + private_key + '",\n')
+ settings_file.write('}\n')
+ settings_file.close()
+
+ print 'Configuration saved in', settings_filepath
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/remoting/tools/runclient.py b/remoting/tools/runclient.py
index 12a4c5f..76e1af2 100755
--- a/remoting/tools/runclient.py
+++ b/remoting/tools/runclient.py
@@ -1,49 +1,56 @@
#!/usr/bin/env python
-#
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
-#
-# runclient.py gets the chromoting host info from an input arg and then
-# tries to find the authentication info in the .chromotingAuthToken file
-# so that the host authentication arguments can be automatically set.
+
+"""Gets the chromoting host info from an input arg and then
+tries to find the authentication info in the .chromotingAuthToken file
+so that the host authentication arguments can be automatically set.
+"""
import os
import platform
-
-auth_filepath = os.path.join(os.path.expanduser('~'), '.chromotingAuthToken')
-script_path = os.path.dirname(__file__)
-
-if platform.system() == "Windows":
- # TODO(garykac): Make this work on Windows.
- print 'Not yet supported on Windows.'
- exit(1)
-elif platform.system() == "Darwin": # Darwin == MacOSX
- client_path = '../../xcodebuild/Debug/chromoting_simple_client'
-else:
- client_path = '../../out/Debug/chromoting_x11_client'
-
-client_path = os.path.join(script_path, client_path)
-
-# Read username and auth token from token file.
-auth = open(auth_filepath)
-authinfo = auth.readlines()
-
-username = authinfo[0].rstrip()
-authtoken = authinfo[1].rstrip()
-
-# Request final 8 characters of Host JID from user.
-# This assumes that the host is published under the same username as the
-# client attempting to connect.
-print 'Host JID:', username + '/chromoting',
-hostjid_suffix = raw_input()
-hostjid = username + '/chromoting' + hostjid_suffix.upper()
-
-command = []
-command.append(client_path)
-command.append('--host_jid ' + hostjid)
-command.append('--jid ' + username)
-command.append('--token ' + authtoken)
-
-# Launch the client
-os.system(' '.join(command))
+import sys
+
+def main():
+ auth_filepath = os.path.join(os.path.expanduser('~'), '.chromotingAuthToken')
+ script_path = os.path.dirname(__file__)
+
+ if platform.system() == "Windows":
+ # TODO(garykac): Make this work on Windows.
+ print 'Not yet supported on Windows.'
+ return 1
+ elif platform.system() == "Darwin": # Darwin == MacOSX
+ client_path = '../../xcodebuild/Debug/chromoting_simple_client'
+ else:
+ client_path = '../../out/Debug/chromoting_x11_client'
+
+ client_path = os.path.join(script_path, client_path)
+
+ # Read username and auth token from token file.
+ auth = open(auth_filepath)
+ authinfo = auth.readlines()
+
+ username = authinfo[0].rstrip()
+ authtoken = authinfo[1].rstrip()
+
+ # Request final 8 characters of Host JID from user.
+ # This assumes that the host is published under the same username as the
+ # client attempting to connect.
+ print 'Host JID:', username + '/chromoting',
+ hostjid_suffix = raw_input()
+ hostjid = username + '/chromoting' + hostjid_suffix.upper()
+
+ command = []
+ command.append(client_path)
+ command.append('--host_jid ' + hostjid)
+ command.append('--jid ' + username)
+ command.append('--token ' + authtoken)
+
+ # Launch the client
+ os.system(' '.join(command))
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py
index c73835a..14b8a6d 100644..100755
--- a/remoting/webapp/build-webapp.py
+++ b/remoting/webapp/build-webapp.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.
@@ -183,7 +183,7 @@ def main():
print ('Usage: build-webapp.py '
'<build-type> <mime-type> <dst> <zip-path> <plugin> '
'<other files...> --locales <locales...>')
- sys.exit(1)
+ return 1
reading_locales = False
files = []
@@ -198,7 +198,8 @@ def main():
buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5],
files, locales)
+ return 0
if __name__ == '__main__':
- main()
+ sys.exit(main())
diff --git a/remoting/webapp/verify-translations.py b/remoting/webapp/verify-translations.py
index 65b253b..c6ffe3a 100755
--- a/remoting/webapp/verify-translations.py
+++ b/remoting/webapp/verify-translations.py
@@ -1,11 +1,13 @@
-#!/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.
"""Verifies that the message tags in the 2nd and subsequent JSON message files
-match those specified in the first. This is typically run when the
-translations are updated before a release, to check that nothing got missed.
+match those specified in the first.
+
+This is typically run when the translations are updated before a release, to
+check that nothing got missed.
"""
import json
@@ -31,10 +33,11 @@ def CheckTranslation(filename, translation, messages):
return False
+
def main():
if len(sys.argv) < 3:
print 'Usage: verify-translations.py <messages> <translation-files...>'
- sys.exit(1)
+ return 1
en_messages = json.load(open(sys.argv[1], 'r'))
exit_code = 0
@@ -43,7 +46,8 @@ def main():
if not CheckTranslation(f, translation, en_messages):
exit_code = 1
- sys.exit(exit_code)
+ return exit_code
+
if __name__ == '__main__':
- main()
+ sys.exit(main())
diff --git a/remoting/webapp/verify-webapp.py b/remoting/webapp/verify-webapp.py
index 1f0cc4f..038de01 100755
--- a/remoting/webapp/verify-webapp.py
+++ b/remoting/webapp/verify-webapp.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.
@@ -78,7 +78,7 @@ def CheckFileForUnknownTag(filename, messages):
def main():
if len(sys.argv) < 4:
print 'Usage: verify-webapp.py <touch> <messages> <message_users...>'
- sys.exit(1)
+ return 1
touch_file = sys.argv[1]
messages = json.load(open(sys.argv[2], 'r'))
@@ -101,8 +101,8 @@ def main():
f.close()
os.utime(touch_file, None)
- sys.exit(exit_code)
+ return exit_code
if __name__ == '__main__':
- main()
+ sys.exit(main())
diff --git a/testing/generate_gmock_mutant.py b/testing/generate_gmock_mutant.py
index 83fbb48..fb977d4 100644..100755
--- a/testing/generate_gmock_mutant.py
+++ b/testing/generate_gmock_mutant.py
@@ -1,9 +1,10 @@
-#!/usr/bin/python
-# Copyright (c) 2009 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.
import string
+import sys
HEADER = """\
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
@@ -447,6 +448,8 @@ def main():
for args in xrange(0, 6 + 1):
GenerateCreateFunctor(prebound, args)
print FOOTER
+ return 0
+
if __name__ == "__main__":
- main()
+ sys.exit(main())
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py
index 4207533..8074242 100644..100755
--- a/ui/gfx/gl/generate_bindings.py
+++ b/ui/gfx/gl/generate_bindings.py
@@ -1,5 +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.
@@ -482,6 +481,7 @@ FUNCTION_SETS = [
'../../../third_party/mesa/MesaLib/include/GL/glxext.h']],
]
+
def GenerateHeader(file, functions, set_name, used_extension_functions):
"""Generates gl_binding_autogen_x.h"""
@@ -754,6 +754,7 @@ def GenerateMockSource(file, functions):
file.write('\n')
file.write('} // namespace gfx\n')
+
def ParseExtensionFunctionsFromHeader(header_file):
"""Parse a C extension header file and return a map from extension names to
a list of functions.
@@ -790,6 +791,7 @@ def ParseExtensionFunctionsFromHeader(header_file):
extensions[current_extension].append(match.group(1))
return extensions
+
def GetExtensionFunctions(extension_headers):
"""Parse extension functions from a list of header files.
@@ -803,6 +805,7 @@ def GetExtensionFunctions(extension_headers):
extensions.update(ParseExtensionFunctionsFromHeader(open(header)))
return extensions
+
def GetFunctionToExtensionMap(extensions):
"""Construct map from a function names to extensions which define the
function.
@@ -820,12 +823,14 @@ def GetFunctionToExtensionMap(extensions):
function_to_extension[function] = extension
return function_to_extension
+
def LooksLikeExtensionFunction(function):
"""Heuristic to see if a function name is consistent with extension function
naming."""
vendor = re.match(r'\w+?([A-Z][A-Z]+)$', function)
return vendor is not None and not vendor.group(1) in ['GL', 'API', 'DC']
+
def GetUsedExtensionFunctions(functions, extension_headers):
"""Determine which functions belong to extensions.
@@ -863,6 +868,7 @@ def GetUsedExtensionFunctions(functions, extension_headers):
key = lambda item: ExtensionSortKey(item[0]))
return used_extension_functions
+
def main(argv):
"""This is the main function."""
@@ -888,7 +894,8 @@ def main(argv):
source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb')
GenerateMockSource(source_file, GL_FUNCTIONS)
source_file.close()
+ return 0
if __name__ == '__main__':
- main(sys.argv[1:])
+ sys.exit(main(sys.argv[1:]))
diff --git a/views/PRESUBMIT.py b/views/PRESUBMIT.py
index 26a2a60..99e25b4 100755
--- a/views/PRESUBMIT.py
+++ b/views/PRESUBMIT.py
@@ -1,5 +1,4 @@
-#!/usr/bin/python
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.