Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: tools/checkbins/checkbin.py

Issue 345015: Rename checkbin to checkbins (because it checks multiple binaries) and set sv... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/checkbins/checkbin.bat ('k') | tools/checkbins/checkbin.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checkbins/checkbin.py
===================================================================
--- tools/checkbins/checkbin.py (revision 30366)
+++ tools/checkbins/checkbin.py (working copy)
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Makes sure that all EXE and DLL files in the provided directory were built
-correctly.
-
-Currently this tool will check that binaries were built with /NXCOMPAT and
-/DYNAMICBASE set.
-"""
-
-import os
-import optparse
-import sys
-
-import pefile
-
-PE_FILE_EXTENSIONS = ['.exe', '.dll']
-DYNAMICBASE_FLAG = 0x0040
-NXCOMPAT_FLAG = 0x0100
-
-def IsPEFile(path):
- return (os.path.isfile(path) and
- os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS)
-
-def main(options, args):
- directory = args[0]
- success = True
-
- for file in os.listdir(directory):
- path = os.path.abspath(os.path.join(directory, file))
- if not IsPEFile(path):
- continue
- pe = pefile.PE(path, fast_load=True)
-
- # Check for /DYNAMICBASE.
- if pe.OPTIONAL_HEADER.DllCharacteristics & DYNAMICBASE_FLAG:
- if options.verbose:
- print "Checking %s for /DYNAMICBASE... PASS" % path
- else:
- success = False
- print "Checking %s for /DYNAMICBASE... FAIL" % path
-
- # Check for /NXCOMPAT.
- if pe.OPTIONAL_HEADER.DllCharacteristics & NXCOMPAT_FLAG:
- if options.verbose:
- print "Checking %s for /NXCOMPAT... PASS" % path
- else:
- success = False
- print "Checking %s for /NXCOMPAT... FAIL" % path
-
- if not success:
- sys.exit(1)
-
-if __name__ == '__main__':
- usage = "Usage: %prog [options] DIRECTORY"
- option_parser = optparse.OptionParser(usage=usage)
- option_parser.add_option("-v", "--verbose", action="store_true",
- default=False, help="Print debug logging")
- options, args = option_parser.parse_args()
- if not args:
- option_parser.print_help()
- sys.exit(0)
- main(options, args)
« no previous file with comments | « tools/checkbins/checkbin.bat ('k') | tools/checkbins/checkbin.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698