Index: webkit/build/webkit_version.py |
diff --git a/webkit/build/webkit_version.py b/webkit/build/webkit_version.py |
index ad07f0d37afcbe78338e10409e1981a09b2abf35..93def61317a9b59fb3c596227852ad975cd32c64 100755 |
--- a/webkit/build/webkit_version.py |
+++ b/webkit/build/webkit_version.py |
@@ -1,10 +1,9 @@ |
#!/usr/bin/env python |
-# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Copyright (c) 2013 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. |
-'''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and |
-MINOR_VERSION, emitting them into a webkit_version.h header file as |
+'''Emits a webkit_version.h header file with |
WEBKIT_MAJOR_VERSION and WEBKIT_MINOR_VERSION macros. |
''' |
@@ -24,42 +23,13 @@ path = os.path.join(path, 'build', 'util') |
sys.path.insert(0, path) |
import lastchange |
-def ReadVersionFile(fname): |
- '''Reads the Webkit Version.xcconfig file looking for MAJOR_VERSION and |
- MINOR_VERSION. This function doesn't attempt to support the full syntax |
- of xcconfig files.''' |
- re_major = re.compile('MAJOR_VERSION\s*=\s*(\d+).*') |
- re_minor = re.compile('MINOR_VERSION\s*=\s*(\d+).*') |
- major = -1 |
- minor = -1 |
- f = open(fname, 'rb') |
- line = "not empty" |
- while line and not (major >= 0 and minor >= 0): |
- line = f.readline() |
- if major == -1: |
- match = re_major.match(line) |
- if match: |
- major = int(match.group(1)) |
- continue |
- if minor == -1: |
- match = re_minor.match(line) |
- if match: |
- minor = int(match.group(1)) |
- continue |
- assert(major >= 0 and minor >= 0) |
- return (major, minor) |
- |
- |
-def GetWebKitRevision(webkit_dir, version_file): |
+ |
+def GetWebKitRevision(webkit_src_dir): |
"""Get the WebKit revision, in the form 'trunk@1234'.""" |
- # "svn info" tells us what we want, but third_party/WebKit does *not* |
- # point at the upstream repo. So instead we run svn info on the directory |
- # containing the versioning file (which is some subdirectory of WebKit). |
- version_file_dir = os.path.dirname(version_file) |
version_info = lastchange.FetchVersionInfo( |
default_lastchange=None, |
- directory=os.path.join(webkit_dir, version_file_dir), |
+ directory=webkit_src_dir, |
directory_regex_prior_to_src_url='webkit') |
if version_info.url == None: |
@@ -72,18 +42,13 @@ def GetWebKitRevision(webkit_dir, version_file): |
return "%s@%s" % (version_info.url, version_info.revision) |
-def EmitVersionHeader(webkit_dir, version_file, output_dir): |
- '''Given webkit's version file, emit a header file that we can use from |
- within webkit_glue.cc. |
- ''' |
- |
- # See .gypi file for discussion of this workaround for the version file. |
- assert version_file[0] == '/' |
- version_file = version_file[1:] |
- |
- major, minor = ReadVersionFile(os.path.join(webkit_dir, version_file)) |
+def EmitVersionHeader(webkit_src_dir, output_dir): |
+ '''Emit a header file that we can use from within webkit_glue.cc.''' |
- webkit_revision = GetWebKitRevision(webkit_dir, version_file) |
+ # These are hard-coded from when we forked Blink. Presumably these |
+ # would be better in a header somewhere. |
darin (slow to review)
2013/04/17 04:53:49
yes, it'd be good to get rid of all of this build-
|
+ major, minor = (537, 36) |
+ webkit_revision = GetWebKitRevision(webkit_src_dir) |
fname = os.path.join(output_dir, "webkit_version.h") |
f = open(fname, 'wb') |
@@ -93,7 +58,7 @@ def EmitVersionHeader(webkit_dir, version_file, output_dir): |
#define WEBKIT_VERSION_MAJOR %d |
#define WEBKIT_VERSION_MINOR %d |
#define WEBKIT_SVN_REVISION "%s" |
-""" % (version_file, major, minor, webkit_revision) |
+""" % (webkit_src_dir, major, minor, webkit_revision) |
f.write(template) |
f.close() |
return 0 |