OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """code generator for GL/GLES extension wrangler.""" | 6 """code generator for GL/GLES extension wrangler.""" |
7 | 7 |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import collections | 10 import collections |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1956 | 1956 |
1957 # Add extensions that do not have any functions. | 1957 # Add extensions that do not have any functions. |
1958 used_extensions.update(extra_extensions) | 1958 used_extensions.update(extra_extensions) |
1959 | 1959 |
1960 return used_extensions | 1960 return used_extensions |
1961 | 1961 |
1962 | 1962 |
1963 def ResolveHeader(header, header_paths): | 1963 def ResolveHeader(header, header_paths): |
1964 paths = header_paths.split(':') | 1964 paths = header_paths.split(':') |
1965 | 1965 |
1966 # Always use a path for Chromium-specific extensions. They are extracted | |
1967 # to separate files. | |
1968 paths.append('.') | |
1969 paths.append('../../gpu') | |
1970 | |
1971 root = os.path.abspath(os.path.dirname(__file__)) | |
1972 | |
1973 for path in paths: | 1966 for path in paths: |
1974 result = os.path.join(path, header) | 1967 result = os.path.join(path, header) |
1975 if not os.path.isabs(path): | 1968 if not os.path.isabs(path): |
1976 result = os.path.relpath(os.path.join(root, result), os.getcwd()) | 1969 result = os.path.relpath(os.path.join(os.getcwd(), result), os.getcwd()) |
Ken Russell (switch to Gerrit)
2014/06/05 17:56:41
Why is using cwd correct? What does rebase_path in
| |
1977 if os.path.exists(result): | 1970 if os.path.exists(result): |
1978 # Always use forward slashes as path separators. Otherwise backslashes | 1971 # Always use forward slashes as path separators. Otherwise backslashes |
1979 # may be incorrectly interpreted as escape characters. | 1972 # may be incorrectly interpreted as escape characters. |
1980 return result.replace(os.path.sep, '/') | 1973 return result.replace(os.path.sep, '/') |
1981 | 1974 |
1982 raise Exception('Header %s not found.' % header) | 1975 raise Exception('Header %s not found.' % header) |
1983 | 1976 |
1984 | 1977 |
1985 def main(argv): | 1978 def main(argv): |
1986 """This is the main function.""" | 1979 """This is the main function.""" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2049 | 2042 |
2050 source_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.cc'), | 2043 source_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.cc'), |
2051 'wb') | 2044 'wb') |
2052 GenerateMockBindingsSource(source_file, GL_FUNCTIONS) | 2045 GenerateMockBindingsSource(source_file, GL_FUNCTIONS) |
2053 source_file.close() | 2046 source_file.close() |
2054 return 0 | 2047 return 0 |
2055 | 2048 |
2056 | 2049 |
2057 if __name__ == '__main__': | 2050 if __name__ == '__main__': |
2058 sys.exit(main(sys.argv[1:])) | 2051 sys.exit(main(sys.argv[1:])) |
OLD | NEW |