2 # Copyright (c) 2011 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.
7 appid.py -- Chromium appid header file generation utility.
13 GENERATED_APPID_INCLUDE_FILE_CONTENTS
= """
14 // This file is automatically generated by appid.py.
15 // It contains the Google Update Appid used for this build. Note that
16 // the Appid will be empty for non Google Chrome builds.
17 namespace google_update {
18 const wchar_t kChromeGuid[] = L"%s";
22 def GenerateAppIdHeader(opts
):
23 contents
= GENERATED_APPID_INCLUDE_FILE_CONTENTS
% opts
.appid
26 ofp
= open(opts
.output_file
, 'r')
27 except EnvironmentError:
28 current_contents
= None
30 current_contents
= ofp
.read()
32 if contents
!= current_contents
:
33 open(opts
.output_file
, 'w').write(contents
)
36 parser
= optparse
.OptionParser()
37 parser
.add_option('-a', '--appid',
38 help='The Google Update App Id of the Chrome being built.')
39 parser
.add_option('-o', '--output_file',
40 help='The path to the generated output header file')
42 (opts
, args
) = parser
.parse_args()
44 if opts
.appid
is None or not opts
.output_file
:
48 # Log a trace in the build output when we run.
49 print "Generating appid header... ",
50 GenerateAppIdHeader(opts
)
55 if __name__
== '__main__':