OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.8.0' | 9 __version__ = '1.8.0' |
10 | 10 |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 'to figure out which PRESUBMIT.py was run, then run git blame\n' | 1420 'to figure out which PRESUBMIT.py was run, then run git blame\n' |
1421 'on the file to figure out who to ask for help.\n') | 1421 'on the file to figure out who to ask for help.\n') |
1422 _ASKED_FOR_FEEDBACK = True | 1422 _ASKED_FOR_FEEDBACK = True |
1423 return output | 1423 return output |
1424 finally: | 1424 finally: |
1425 os.environ = old_environ | 1425 os.environ = old_environ |
1426 | 1426 |
1427 | 1427 |
1428 def ScanSubDirs(mask, recursive): | 1428 def ScanSubDirs(mask, recursive): |
1429 if not recursive: | 1429 if not recursive: |
1430 return [x for x in glob.glob(mask) if '.svn' not in x and '.git' not in x] | 1430 return [x for x in glob.glob(mask) if x not in ('.svn', '.git')] |
1431 else: | 1431 else: |
1432 results = [] | 1432 results = [] |
1433 for root, dirs, files in os.walk('.'): | 1433 for root, dirs, files in os.walk('.'): |
1434 if '.svn' in dirs: | 1434 if '.svn' in dirs: |
1435 dirs.remove('.svn') | 1435 dirs.remove('.svn') |
1436 if '.git' in dirs: | 1436 if '.git' in dirs: |
1437 dirs.remove('.git') | 1437 dirs.remove('.git') |
1438 for name in files: | 1438 for name in files: |
1439 if fnmatch.fnmatch(name, mask): | 1439 if fnmatch.fnmatch(name, mask): |
1440 results.append(os.path.join(root, name)) | 1440 results.append(os.path.join(root, name)) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 except PresubmitFailure, e: | 1652 except PresubmitFailure, e: |
1653 print >> sys.stderr, e | 1653 print >> sys.stderr, e |
1654 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1654 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1655 print >> sys.stderr, 'If all fails, contact maruel@' | 1655 print >> sys.stderr, 'If all fails, contact maruel@' |
1656 return 2 | 1656 return 2 |
1657 | 1657 |
1658 | 1658 |
1659 if __name__ == '__main__': | 1659 if __name__ == '__main__': |
1660 fix_encoding.fix_encoding() | 1660 fix_encoding.fix_encoding() |
1661 sys.exit(Main(None)) | 1661 sys.exit(Main(None)) |
OLD | NEW |