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

Unified Diff: ui/gfx/gl/generate_bindings.py

Issue 8665013: Fix many* python scripts in src/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed chrome_frame/tools/test/page_cycler/cf_cycler.py 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 | « testing/generate_gmock_mutant.py ('k') | views/PRESUBMIT.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gl/generate_bindings.py
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py
old mode 100644
new mode 100755
index 4207533193c9d62b70736e9af0e39e03993637fa..80742422b497a88d36a54316bb6d2715a650c763
--- 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:]))
« no previous file with comments | « testing/generate_gmock_mutant.py ('k') | views/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698