Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 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 '''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and | 6 '''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and |
| 7 MINOR_VERSION, emitting them into a webkit_version.h header file as | 7 MINOR_VERSION, emitting them into a webkit_version.h header file as |
| 8 WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros. | 8 WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros. |
| 9 ''' | 9 ''' |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 """Get the WebKit revision, in the form 'trunk@1234'.""" | 53 """Get the WebKit revision, in the form 'trunk@1234'.""" |
| 54 | 54 |
| 55 # "svn info" tells us what we want, but third_party/WebKit does *not* | 55 # "svn info" tells us what we want, but third_party/WebKit does *not* |
| 56 # point at the upstream repo. So instead we run svn info on the directory | 56 # point at the upstream repo. So instead we run svn info on the directory |
| 57 # containing the versioning file (which is some subdirectory of WebKit). | 57 # containing the versioning file (which is some subdirectory of WebKit). |
| 58 version_file_dir = os.path.dirname(version_file) | 58 version_file_dir = os.path.dirname(version_file) |
| 59 version_info = lastchange.FetchVersionInfo( | 59 version_info = lastchange.FetchVersionInfo( |
| 60 default_lastchange=None, | 60 default_lastchange=None, |
| 61 directory=os.path.join(webkit_dir, version_file_dir)) | 61 directory=os.path.join(webkit_dir, version_file_dir)) |
| 62 | 62 |
| 63 if (version_info.url.startswith(version_info.root) and | 63 if (version_info.url and |
| 64 version_info.root and | |
| 65 version_info.url.startswith(version_info.root) and | |
|
Mark Mentovai
2011/07/19 15:44:32
What I meant was that you’ve changed the contents
| |
| 64 version_info.url.endswith(version_file_dir)): | 66 version_info.url.endswith(version_file_dir)): |
| 65 # Now compute the real WebKit URL by stripping off the version file | 67 # Now compute the real WebKit URL by stripping off the version file |
| 66 # directory from the URL we get out of version_info. | 68 # directory from the URL we get out of version_info. |
| 67 # Further, we want to strip off the "http://svn..." from the left. | 69 # Further, we want to strip off the "http://svn..." from the left. |
| 68 # This is the root URL from the repository. | 70 # This is the root URL from the repository. |
| 69 webkit_url = version_info.url[len(version_info.root):-len(version_file_dir)] | 71 webkit_url = version_info.url[len(version_info.root):-len(version_file_dir)] |
| 70 webkit_url = webkit_url.strip('/') | 72 webkit_url = webkit_url.strip('/') |
| 71 else: | 73 else: |
| 72 # The data isn't as we expect: perhaps they're using git without svn? | 74 # The data isn't as we expect: perhaps they're using git without svn? |
| 73 # Just dump the output directly. | 75 # Just dump the output directly. |
| 74 webkit_url = version_info.url | 76 webkit_url = version_info.url |
| 75 | 77 |
| 78 if version_info.revision == None: | |
| 79 version_info.revision = '0' | |
| 80 | |
| 76 return "%s@%s" % (webkit_url, version_info.revision) | 81 return "%s@%s" % (webkit_url, version_info.revision) |
| 77 | 82 |
| 78 | 83 |
| 79 def EmitVersionHeader(webkit_dir, version_file, output_dir): | 84 def EmitVersionHeader(webkit_dir, version_file, output_dir): |
| 80 '''Given webkit's version file, emit a header file that we can use from | 85 '''Given webkit's version file, emit a header file that we can use from |
| 81 within webkit_glue.cc. | 86 within webkit_glue.cc. |
| 82 ''' | 87 ''' |
| 83 | 88 |
| 84 # See .gypi file for discussion of this workaround for the version file. | 89 # See .gypi file for discussion of this workaround for the version file. |
| 85 assert version_file[0] == '/' | 90 assert version_file[0] == '/' |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 100 """ % (version_file, major, minor, webkit_revision) | 105 """ % (version_file, major, minor, webkit_revision) |
| 101 f.write(template) | 106 f.write(template) |
| 102 f.close() | 107 f.close() |
| 103 | 108 |
| 104 def main(): | 109 def main(): |
| 105 EmitVersionHeader(*sys.argv[1:]) | 110 EmitVersionHeader(*sys.argv[1:]) |
| 106 | 111 |
| 107 | 112 |
| 108 if __name__ == "__main__": | 113 if __name__ == "__main__": |
| 109 main() | 114 main() |
| 110 | |
| 111 | |
| OLD | NEW |