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 == None: |
64 version_info.url.endswith(version_file_dir)): | 64 version_info.url = 'Unknown URL' |
65 # Now compute the real WebKit URL by stripping off the version file | 65 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 | 66 |
76 return "%s@%s" % (webkit_url, version_info.revision) | 67 if version_info.revision == None: |
| 68 version_info.revision = '0' |
| 69 |
| 70 return "%s@%s" % (version_info.url, version_info.revision) |
77 | 71 |
78 | 72 |
79 def EmitVersionHeader(webkit_dir, version_file, output_dir): | 73 def EmitVersionHeader(webkit_dir, version_file, output_dir): |
80 '''Given webkit's version file, emit a header file that we can use from | 74 '''Given webkit's version file, emit a header file that we can use from |
81 within webkit_glue.cc. | 75 within webkit_glue.cc. |
82 ''' | 76 ''' |
83 | 77 |
84 # See .gypi file for discussion of this workaround for the version file. | 78 # See .gypi file for discussion of this workaround for the version file. |
85 assert version_file[0] == '/' | 79 assert version_file[0] == '/' |
86 version_file = version_file[1:] | 80 version_file = version_file[1:] |
(...skipping 13 matching lines...) Expand all Loading... |
100 """ % (version_file, major, minor, webkit_revision) | 94 """ % (version_file, major, minor, webkit_revision) |
101 f.write(template) | 95 f.write(template) |
102 f.close() | 96 f.close() |
103 | 97 |
104 def main(): | 98 def main(): |
105 EmitVersionHeader(*sys.argv[1:]) | 99 EmitVersionHeader(*sys.argv[1:]) |
106 | 100 |
107 | 101 |
108 if __name__ == "__main__": | 102 if __name__ == "__main__": |
109 main() | 103 main() |
110 | |
111 | |
OLD | NEW |