| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Makes sure that all EXE and DLL files in the provided directory were built | 6 """Makes sure that all EXE and DLL files in the provided directory were built |
| 7 correctly. | 7 correctly. |
| 8 | 8 |
| 9 Currently this tool will check that binaries were built with /NXCOMPAT and | 9 Currently this tool will check that binaries were built with /NXCOMPAT and |
| 10 /DYNAMICBASE set. | 10 /DYNAMICBASE set. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import os | 13 import os |
| 14 import optparse | 14 import optparse |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 # Find /third_party/pefile based on current directory and script path. | 17 # Find /third_party/pefile based on current directory and script path. |
| 18 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', | 18 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', |
| 19 'third_party', 'pefile')) | 19 'third_party', 'pefile')) |
| 20 import pefile | 20 import pefile |
| 21 | 21 |
| 22 PE_FILE_EXTENSIONS = ['.exe', '.dll'] | 22 PE_FILE_EXTENSIONS = ['.exe', '.dll'] |
| 23 DYNAMICBASE_FLAG = 0x0040 | 23 DYNAMICBASE_FLAG = 0x0040 |
| 24 NXCOMPAT_FLAG = 0x0100 | 24 NXCOMPAT_FLAG = 0x0100 |
| 25 | 25 |
| 26 # Please do not add your file here without confirming that it indeed doesn't | 26 # Please do not add your file here without confirming that it indeed doesn't |
| 27 # require /NXCOMPAT and /DYNAMICBASE. Contact cpu@chromium.org or your local | 27 # require /NXCOMPAT and /DYNAMICBASE. Contact cpu@chromium.org or your local |
| 28 # Windows guru for advice. | 28 # Windows guru for advice. |
| 29 EXCLUDED_FILES = ['chrome_frame_mini_installer.exe', | 29 EXCLUDED_FILES = ['chrome_frame_mini_installer.exe', |
| 30 'icudt42.dll', | |
| 31 'mini_installer.exe', | 30 'mini_installer.exe', |
| 32 'wow_helper.exe'] | 31 'wow_helper.exe'] |
| 33 | 32 |
| 34 def IsPEFile(path): | 33 def IsPEFile(path): |
| 35 return (os.path.isfile(path) and | 34 return (os.path.isfile(path) and |
| 36 os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS and | 35 os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS and |
| 37 os.path.basename(path) not in EXCLUDED_FILES) | 36 os.path.basename(path) not in EXCLUDED_FILES) |
| 38 | 37 |
| 39 def main(options, args): | 38 def main(options, args): |
| 40 directory = args[0] | 39 directory = args[0] |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if __name__ == '__main__': | 75 if __name__ == '__main__': |
| 77 usage = "Usage: %prog [options] DIRECTORY" | 76 usage = "Usage: %prog [options] DIRECTORY" |
| 78 option_parser = optparse.OptionParser(usage=usage) | 77 option_parser = optparse.OptionParser(usage=usage) |
| 79 option_parser.add_option("-v", "--verbose", action="store_true", | 78 option_parser.add_option("-v", "--verbose", action="store_true", |
| 80 default=False, help="Print debug logging") | 79 default=False, help="Print debug logging") |
| 81 options, args = option_parser.parse_args() | 80 options, args = option_parser.parse_args() |
| 82 if not args: | 81 if not args: |
| 83 option_parser.print_help() | 82 option_parser.print_help() |
| 84 sys.exit(0) | 83 sys.exit(0) |
| 85 main(options, args) | 84 main(options, args) |
| OLD | NEW |