| 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 """Script to verify a Portable Executable's dependencies. | 6 """Script to verify a Portable Executable's dependencies. |
| 7 | 7 |
| 8 Analyzes the input portable executable (a DLL or an EXE for example), extracts | 8 Analyzes the input portable executable (a DLL or an EXE for example), extracts |
| 9 its imports and confirms that its dependencies haven't changed. This is for | 9 its imports and confirms that its dependencies haven't changed. This is for |
| 10 regression testing. | 10 regression testing. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 | 151 |
| 152 def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose): | 152 def VerifyDependents(pe_name, dependents, delay_loaded, list_file, verbose): |
| 153 """Compare the actual dependents to the expected ones.""" | 153 """Compare the actual dependents to the expected ones.""" |
| 154 scope = {} | 154 scope = {} |
| 155 try: | 155 try: |
| 156 execfile(list_file, scope) | 156 execfile(list_file, scope) |
| 157 except: | 157 except: |
| 158 raise Error("Failed to load " + list_file) | 158 raise Error("Failed to load " + list_file) |
| 159 | 159 |
| 160 # The dependency files have dependencies in two section - dependents and delay
_loaded | 160 # The dependency files have dependencies in two section - dependents and |
| 161 # Also various distributions of Chromium can have different dependencies. So f
irst | 161 # delay_loaded. Also various distributions of Chromium can have different |
| 162 # we read generic dependencies ("dependents" and "delay_loaded"). If distribut
ion | 162 # dependencies. So first we read generic dependencies ("dependents" and |
| 163 # specific dependencies exist (i.e. "dependents_google_chrome" and | 163 # "delay_loaded"). If distribution specific dependencies exist |
| 164 # "delay_loaded_google_chrome") we use those instead. | 164 # (i.e. "dependents_google_chrome" and "delay_loaded_google_chrome") we use |
| 165 # those instead. |
| 165 distribution = DIST_DEFAULT | 166 distribution = DIST_DEFAULT |
| 166 if DIST_ENV_VAR in os.environ.keys(): | 167 if DIST_ENV_VAR in os.environ.keys(): |
| 167 distribution = os.environ[DIST_ENV_VAR].lower() | 168 distribution = os.environ[DIST_ENV_VAR].lower() |
| 168 | 169 |
| 169 expected_dependents = scope["dependents"] | 170 expected_dependents = scope["dependents"] |
| 170 dist_dependents = "dependents" + distribution | 171 dist_dependents = "dependents" + distribution |
| 171 if dist_dependents in scope.keys(): | 172 if dist_dependents in scope.keys(): |
| 172 expected_dependents = scope[dist_dependents] | 173 expected_dependents = scope[dist_dependents] |
| 173 | 174 |
| 174 expected_delay_loaded = scope["delay_loaded"] | 175 expected_delay_loaded = scope["delay_loaded"] |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 "--debug", | 217 "--debug", |
| 217 dest="debug", | 218 dest="debug", |
| 218 action="store_true", | 219 action="store_true", |
| 219 default=False, | 220 default=False, |
| 220 help="Display debugging information") | 221 help="Display debugging information") |
| 221 options, args = option_parser.parse_args() | 222 options, args = option_parser.parse_args() |
| 222 if len(args) != 2: | 223 if len(args) != 2: |
| 223 option_parser.error("Incorrect number of arguments") | 224 option_parser.error("Incorrect number of arguments") |
| 224 sys.exit(main(options, args)) | 225 sys.exit(main(options, args)) |
| 225 | 226 |
| OLD | NEW |