OLD | NEW |
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 try: | 616 try: |
617 sys.path = sys.path + [input_api.os_path.join( | 617 sys.path = sys.path + [input_api.os_path.join( |
618 input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')] | 618 input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')] |
619 from check_orphan_headers import GetBuildGnPathFromFilePath | 619 from check_orphan_headers import GetBuildGnPathFromFilePath |
620 from check_orphan_headers import IsHeaderInBuildGn | 620 from check_orphan_headers import IsHeaderInBuildGn |
621 finally: | 621 finally: |
622 # Restore sys.path to what it was before. | 622 # Restore sys.path to what it was before. |
623 sys.path = original_sys_path | 623 sys.path = original_sys_path |
624 | 624 |
625 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): | 625 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): |
626 if f.LocalPath().endswith('.h'): | 626 if f.LocalPath().endswith('.h') and f.Action() == 'A': |
627 file_path = os.path.abspath(f.LocalPath()) | 627 file_path = os.path.abspath(f.LocalPath()) |
628 root_dir = os.getcwd() | 628 root_dir = os.getcwd() |
629 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists, | 629 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists, |
630 root_dir) | 630 root_dir) |
631 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path) | 631 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path) |
632 if not in_build_gn: | 632 if not in_build_gn: |
633 results.append(output_api.PresubmitError(error_msg.format( | 633 results.append(output_api.PresubmitError(error_msg.format( |
634 file_path, gn_file_path))) | 634 file_path, gn_file_path))) |
635 return results | 635 return results |
OLD | NEW |