| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 def copyfile(self, source, destination): | 73 def copyfile(self, source, destination): |
| 74 shutil.copyfile(source, destination) | 74 shutil.copyfile(source, destination) |
| 75 | 75 |
| 76 def dirname(self, path): | 76 def dirname(self, path): |
| 77 return os.path.dirname(path) | 77 return os.path.dirname(path) |
| 78 | 78 |
| 79 def exists(self, path): | 79 def exists(self, path): |
| 80 return os.path.exists(path) | 80 return os.path.exists(path) |
| 81 | 81 |
| 82 def getsize(self, path): |
| 83 return os.path.getsize(path) |
| 84 |
| 82 def files_under(self, path, dirs_to_skip=[], file_filter=None): | 85 def files_under(self, path, dirs_to_skip=[], file_filter=None): |
| 83 """Return the list of all files under the given path in topdown order. | 86 """Return the list of all files under the given path in topdown order. |
| 84 | 87 |
| 85 Args: | 88 Args: |
| 86 dirs_to_skip: a list of directories to skip over during the | 89 dirs_to_skip: a list of directories to skip over during the |
| 87 traversal (e.g., .svn, resources, etc.) | 90 traversal (e.g., .svn, resources, etc.) |
| 88 file_filter: if not None, the filter will be invoked | 91 file_filter: if not None, the filter will be invoked |
| 89 with the filesystem object and the dirname and basename of | 92 with the filesystem object and the dirname and basename of |
| 90 each file found. The file is included in the result if the | 93 each file found. The file is included in the result if the |
| 91 callback returns True. | 94 callback returns True. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 def split(self, path): | 277 def split(self, path): |
| 275 """Return (dirname, basename + '.' + ext)""" | 278 """Return (dirname, basename + '.' + ext)""" |
| 276 return os.path.split(path) | 279 return os.path.split(path) |
| 277 | 280 |
| 278 def splitext(self, path): | 281 def splitext(self, path): |
| 279 """Return (dirname + os.sep + basename, '.' + ext)""" | 282 """Return (dirname + os.sep + basename, '.' + ext)""" |
| 280 return os.path.splitext(path) | 283 return os.path.splitext(path) |
| 281 | 284 |
| 282 def make_executable(self, file_path): | 285 def make_executable(self, file_path): |
| 283 os.chmod(file_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_
IRGRP | stat.S_IXGRP) | 286 os.chmod(file_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_
IRGRP | stat.S_IXGRP) |
| OLD | NEW |