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.6.1' | 9 __version__ = '1.6.1' |
10 | 10 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 def LocalPath(self): | 447 def LocalPath(self): |
448 """Returns the path of this file on the local disk relative to client root. | 448 """Returns the path of this file on the local disk relative to client root. |
449 """ | 449 """ |
450 return normpath(self._path) | 450 return normpath(self._path) |
451 | 451 |
452 def AbsoluteLocalPath(self): | 452 def AbsoluteLocalPath(self): |
453 """Returns the absolute path of this file on the local disk. | 453 """Returns the absolute path of this file on the local disk. |
454 """ | 454 """ |
455 return os.path.abspath(os.path.join(self._local_root, self.LocalPath())) | 455 return os.path.abspath(os.path.join(self._local_root, self.LocalPath())) |
456 | 456 |
457 def GetFileExt(self): | |
M-A Ruel
2012/02/16 22:35:43
I'd rather not add _yet another member_. Since it'
bulach
2012/02/17 01:25:15
sounds reasonable. removed..
| |
458 """Returns the extension of this file.""" | |
459 return os.path.splitext(self._path)[1] | |
460 | |
457 def IsDirectory(self): | 461 def IsDirectory(self): |
458 """Returns true if this object is a directory.""" | 462 """Returns true if this object is a directory.""" |
459 if self._is_directory is None: | 463 if self._is_directory is None: |
460 path = self.AbsoluteLocalPath() | 464 path = self.AbsoluteLocalPath() |
461 self._is_directory = (os.path.exists(path) and | 465 self._is_directory = (os.path.exists(path) and |
462 os.path.isdir(path)) | 466 os.path.isdir(path)) |
463 return self._is_directory | 467 return self._is_directory |
464 | 468 |
465 def Action(self): | 469 def Action(self): |
466 """Returns the action on this opened file, e.g. A, M, D, etc.""" | 470 """Returns the action on this opened file, e.g. A, M, D, etc.""" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1265 except PresubmitFailure, e: | 1269 except PresubmitFailure, e: |
1266 print >> sys.stderr, e | 1270 print >> sys.stderr, e |
1267 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1271 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1268 print >> sys.stderr, 'If all fails, contact maruel@' | 1272 print >> sys.stderr, 'If all fails, contact maruel@' |
1269 return 2 | 1273 return 2 |
1270 | 1274 |
1271 | 1275 |
1272 if __name__ == '__main__': | 1276 if __name__ == '__main__': |
1273 fix_encoding.fix_encoding() | 1277 fix_encoding.fix_encoding() |
1274 sys.exit(Main(None)) | 1278 sys.exit(Main(None)) |
OLD | NEW |