| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Compare the artifacts from two builds.""" | 5 """Compare the artifacts from two builds.""" |
| 6 | 6 |
| 7 import filecmp | 7 import filecmp |
| 8 import json | 8 import json |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 | 13 |
| 14 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 14 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 15 | 15 |
| 16 | 16 |
| 17 def get_files_to_compare(build_dir): | 17 def get_files_to_compare(build_dir): |
| 18 """Get the list of files to compare.""" | 18 """Get the list of files to compare.""" |
| 19 allowed = frozenset( | 19 allowed = frozenset( |
| 20 ('', '.app', '.dll', '.dylib', '.exe', '.nexe', '.pdb', '.so')) | 20 ('', '.app', '.dll', '.dylib', '.exe', '.nexe', '.pdb', '.so')) |
| 21 | 21 |
| 22 def check(f): | 22 def check(f): |
| 23 if not os.path.isfile(f): | 23 if not os.path.isfile(f): |
| 24 return False | 24 return False |
| 25 if os.path.basename(f).startswith('.'): |
| 26 return False |
| 25 ext = os.path.splitext(f)[1] | 27 ext = os.path.splitext(f)[1] |
| 26 if ext == '.isolated': | 28 if ext == '.isolated': |
| 27 return True | 29 return True |
| 28 return ext in allowed and os.access(f, os.X_OK) | 30 return ext in allowed and os.access(f, os.X_OK) |
| 29 | 31 |
| 30 return set(f for f in os.listdir(build_dir) if | 32 return set(f for f in os.listdir(build_dir) if |
| 31 check(os.path.join(build_dir, f))) | 33 check(os.path.join(build_dir, f))) |
| 32 | 34 |
| 33 | 35 |
| 34 def compare_build_artifacts(first_dir, second_dir): | 36 def compare_build_artifacts(first_dir, second_dir): |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 parser.error('--first-build-dir is required') | 77 parser.error('--first-build-dir is required') |
| 76 if not options.second_build_dir: | 78 if not options.second_build_dir: |
| 77 parser.error('--second-build-dir is required') | 79 parser.error('--second-build-dir is required') |
| 78 | 80 |
| 79 return compare_build_artifacts(options.first_build_dir, | 81 return compare_build_artifacts(options.first_build_dir, |
| 80 options.second_build_dir) | 82 options.second_build_dir) |
| 81 | 83 |
| 82 | 84 |
| 83 if __name__ == '__main__': | 85 if __name__ == '__main__': |
| 84 sys.exit(main()) | 86 sys.exit(main()) |
| OLD | NEW |