| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 def GetWebKitRevision(webkit_dir, version_file): | 52 def GetWebKitRevision(webkit_dir, version_file): |
| 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 directory_regex_prior_to_src_url='webkit') |
| 62 | 63 |
| 63 if (version_info.url.startswith(version_info.root) and | 64 if version_info.url == None: |
| 64 version_info.url.endswith(version_file_dir)): | 65 version_info.url = 'Unknown URL' |
| 65 # Now compute the real WebKit URL by stripping off the version file | 66 version_info.url = version_info.url.strip('/') |
| 66 # directory from the URL we get out of version_info. | |
| 67 # Further, we want to strip off the "http://svn..." from the left. | |
| 68 # This is the root URL from the repository. | |
| 69 webkit_url = version_info.url[len(version_info.root):-len(version_file_dir)] | |
| 70 webkit_url = webkit_url.strip('/') | |
| 71 else: | |
| 72 # The data isn't as we expect: perhaps they're using git without svn? | |
| 73 # Just dump the output directly. | |
| 74 webkit_url = version_info.url | |
| 75 | 67 |
| 76 return "%s@%s" % (webkit_url, version_info.revision) | 68 if version_info.revision == None: |
| 69 version_info.revision = '0' |
| 70 |
| 71 return "%s@%s" % (version_info.url, version_info.revision) |
| 77 | 72 |
| 78 | 73 |
| 79 def EmitVersionHeader(webkit_dir, version_file, output_dir): | 74 def EmitVersionHeader(webkit_dir, version_file, output_dir): |
| 80 '''Given webkit's version file, emit a header file that we can use from | 75 '''Given webkit's version file, emit a header file that we can use from |
| 81 within webkit_glue.cc. | 76 within webkit_glue.cc. |
| 82 ''' | 77 ''' |
| 83 | 78 |
| 84 # See .gypi file for discussion of this workaround for the version file. | 79 # See .gypi file for discussion of this workaround for the version file. |
| 85 assert version_file[0] == '/' | 80 assert version_file[0] == '/' |
| 86 version_file = version_file[1:] | 81 version_file = version_file[1:] |
| (...skipping 13 matching lines...) Expand all Loading... |
| 100 """ % (version_file, major, minor, webkit_revision) | 95 """ % (version_file, major, minor, webkit_revision) |
| 101 f.write(template) | 96 f.write(template) |
| 102 f.close() | 97 f.close() |
| 103 | 98 |
| 104 def main(): | 99 def main(): |
| 105 EmitVersionHeader(*sys.argv[1:]) | 100 EmitVersionHeader(*sys.argv[1:]) |
| 106 | 101 |
| 107 | 102 |
| 108 if __name__ == "__main__": | 103 if __name__ == "__main__": |
| 109 main() | 104 main() |
| 110 | |
| 111 | |
| OLD | NEW |