This commit is contained in:
Barış Metin
2005-06-29 20:04:46 +00:00
parent d0af4dcbdd
commit f085ec39b2
+5 -4
View File
@@ -150,11 +150,12 @@ def copy_file(src,dest):
shutil.copyfile(src, dest) shutil.copyfile(src, dest)
def get_file_hashes(top, excludePrefixes=None, removePrefix=None): def get_file_hashes(top, excludePrefixes=None, removePrefix=None):
"""Generator function iterates over a toplevel path and gives the """Generator function iterates over a toplevel path and returns the
(filePath, sha1Hash) tuple for all files. If excludePrefixes list (filePath, sha1Hash) tuple for all files. If excludePrefixes list
is given function will exclude the filePaths matching those is given as a parameter, function will exclude the filePaths
prefixes. The removePrefix string parameter will be used to remove matching those prefixes. The removePrefix string parameter will be
prefix from filePath while matching excludes, if given.""" used to remove prefix from filePath while matching excludes, if
given."""
for root, dirs, files in os.walk(top, topdown=False): for root, dirs, files in os.walk(top, topdown=False):
# check if root matches an exclude, and continue # check if root matches an exclude, and continue
if excludePrefixes and removePrefix: if excludePrefixes and removePrefix: