OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 """Script used to scan for server DLLs at build time and build a header | 6 """Script used to scan for server DLLs at build time and build a header |
7 included by setup.exe. This header contains an array of the names of | 7 included by setup.exe. This header contains an array of the names of |
8 the DLLs that need registering at install time. | 8 the DLLs that need registering at install time. |
9 | |
10 """ | 9 """ |
11 | 10 |
12 import ConfigParser | 11 import ConfigParser |
13 import glob | 12 import glob |
14 import optparse | 13 import optparse |
15 import os | 14 import os |
16 import sys | 15 import sys |
17 | 16 |
18 CHROME_DIR = "Chrome-bin" | 17 CHROME_DIR = "Chrome-bin" |
19 SERVERS_DIR = "servers" | 18 SERVERS_DIR = "servers" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if file_name.lower().endswith('.dll'): | 120 if file_name.lower().endswith('.dll'): |
122 print "Found server DLL file: " + file_name | 121 print "Found server DLL file: " + file_name |
123 registered_dll_list.append(file_name) | 122 registered_dll_list.append(file_name) |
124 | 123 |
125 | 124 |
126 def RunSystemCommand(cmd): | 125 def RunSystemCommand(cmd): |
127 if (os.system(cmd) != 0): | 126 if (os.system(cmd) != 0): |
128 raise "Error while running cmd: %s" % cmd | 127 raise "Error while running cmd: %s" % cmd |
129 | 128 |
130 | 129 |
131 def main(options): | 130 def main(): |
132 """Main method that reads input file, scans <build_output>\servers for | 131 """Main method that reads input file, scans <build_output>\servers for |
133 matches to files described in the input file. A header file for the | 132 matches to files described in the input file. A header file for the |
134 setup project is then generated. | 133 setup project is then generated. |
135 """ | 134 """ |
136 config = Readconfig(options.output_dir, options.input_file) | |
137 registered_dll_list = ScanServerDlls(config, options.distribution, | |
138 options.output_dir) | |
139 CreateRegisteredDllIncludeFile(registered_dll_list, | |
140 options.header_output_dir) | |
141 | |
142 | |
143 if '__main__' == __name__: | |
144 option_parser = optparse.OptionParser() | 135 option_parser = optparse.OptionParser() |
145 option_parser.add_option('-o', '--output_dir', help='Build Output directory') | 136 option_parser.add_option('-o', '--output_dir', help='Build Output directory') |
146 option_parser.add_option('-x', '--header_output_dir', | 137 option_parser.add_option('-x', '--header_output_dir', |
147 help='Location where the generated header file will be placed.') | 138 help='Location where the generated header file will be placed.') |
148 option_parser.add_option('-i', '--input_file', help='Input file') | 139 option_parser.add_option('-i', '--input_file', help='Input file') |
149 option_parser.add_option('-d', '--distribution', | 140 option_parser.add_option('-d', '--distribution', |
150 help='Name of Chromium Distribution. Optional.') | 141 help='Name of Chromium Distribution. Optional.') |
151 | 142 |
152 options, args = option_parser.parse_args() | 143 options, args = option_parser.parse_args() |
153 sys.exit(main(options)) | 144 config = Readconfig(options.output_dir, options.input_file) |
| 145 registered_dll_list = ScanServerDlls(config, options.distribution, |
| 146 options.output_dir) |
| 147 CreateRegisteredDllIncludeFile(registered_dll_list, |
| 148 options.header_output_dir) |
| 149 return 0 |
| 150 |
| 151 |
| 152 if '__main__' == __name__: |
| 153 sys.exit(main()) |
OLD | NEW |