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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 self.unittest = unittest | 304 self.unittest = unittest |
305 self.urllib2 = urllib2 | 305 self.urllib2 = urllib2 |
306 | 306 |
307 # To easily fork python. | 307 # To easily fork python. |
308 self.python_executable = sys.executable | 308 self.python_executable = sys.executable |
309 self.environ = os.environ | 309 self.environ = os.environ |
310 | 310 |
311 # InputApi.platform is the platform you're currently running on. | 311 # InputApi.platform is the platform you're currently running on. |
312 self.platform = sys.platform | 312 self.platform = sys.platform |
313 | 313 |
| 314 self.cpu_count = multiprocessing.cpu_count() |
| 315 |
314 # The local path of the currently-being-processed presubmit script. | 316 # The local path of the currently-being-processed presubmit script. |
315 self._current_presubmit_path = os.path.dirname(presubmit_path) | 317 self._current_presubmit_path = os.path.dirname(presubmit_path) |
316 | 318 |
317 # We carry the canned checks so presubmit scripts can easily use them. | 319 # We carry the canned checks so presubmit scripts can easily use them. |
318 self.canned_checks = presubmit_canned_checks | 320 self.canned_checks = presubmit_canned_checks |
319 | 321 |
320 # TODO(dpranke): figure out a list of all approved owners for a repo | 322 # TODO(dpranke): figure out a list of all approved owners for a repo |
321 # in order to be able to handle wildcard OWNERS files? | 323 # in order to be able to handle wildcard OWNERS files? |
322 self.owners_db = owners.Database(change.RepositoryRoot(), | 324 self.owners_db = owners.Database(change.RepositoryRoot(), |
323 fopen=file, os_path=self.os_path, glob=self.glob) | 325 fopen=file, os_path=self.os_path, glob=self.glob) |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 return 2 | 1748 return 2 |
1747 | 1749 |
1748 | 1750 |
1749 if __name__ == '__main__': | 1751 if __name__ == '__main__': |
1750 fix_encoding.fix_encoding() | 1752 fix_encoding.fix_encoding() |
1751 try: | 1753 try: |
1752 sys.exit(main()) | 1754 sys.exit(main()) |
1753 except KeyboardInterrupt: | 1755 except KeyboardInterrupt: |
1754 sys.stderr.write('interrupted\n') | 1756 sys.stderr.write('interrupted\n') |
1755 sys.exit(1) | 1757 sys.exit(1) |
OLD | NEW |