2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Embeds Chrome user data files in C++ code."""
16 sys
.path
.insert(0, os
.path
.join(chrome_paths
.GetSrc(), 'build', 'util'))
21 parser
= optparse
.OptionParser()
22 parser
.add_option('', '--version-file')
24 '', '--directory', type='string', default
='.',
25 help='Path to directory where the cc/h file should be created')
26 options
, args
= parser
.parse_args()
28 version
= open(options
.version_file
, 'r').read().strip()
29 revision
= lastchange
.FetchVersionInfo(None).revision
32 match
= re
.match('([0-9a-fA-F]+)(-refs/heads/master@{#(\d+)})?', revision
)
34 git_hash
= match
.group(1)
35 commit_position
= match
.group(3)
37 version
+= '.' + commit_position
38 version
+= ' (%s)' % git_hash
40 version
+= ' (%s)' % revision
43 'kChromeDriverVersion': version
45 cpp_source
.WriteSource('version',
46 'chrome/test/chromedriver',
47 options
.directory
, global_string_map
)
50 if __name__
== '__main__':