This commit is contained in:
A. Murat Eren
2005-08-09 07:53:49 +00:00
parent 57f845d91b
commit 6503afaef3
+13 -7
View File
@@ -199,13 +199,19 @@ def get_file_hashes(top, excludePrefixes=None, removePrefix=None):
else: else:
return 0 return 0
return 0 return 0
for root, dirs, files in os.walk(top, topdown=False): for root, dirs, files in os.walk(top, topdown=False):
if os.path.islink(root): if os.path.islink(root) and not hasExcludedPrefix(root):
if not hasExcludedPrefix(root): #yield the symlink..
#yield the symlink.. yield (root, sha1_file(root))
yield (root, sha1_file(root)) excludePrefixes.append(remove_prefix(removePrefix, root) + "/")
excludePrefixes.append(remove_prefix(removePrefix, root) + "/") continue
if os.path.isdir(root) and not hasExcludedPrefix(root):
parent, r, d, f = root, '', '', ''
for r, d, f in os.walk(parent, topdown=False): pass
if not f and not d:
yield (parent, sha1_file(parent))
for fname in files: for fname in files:
f = os.path.join(root, fname) f = os.path.join(root, fname)
@@ -235,7 +241,7 @@ def sha1_file(filename):
m.update(l) m.update(l)
return m.hexdigest() return m.hexdigest()
except IOError: except IOError:
return "0" return "0"
def uncompress(patchFile, compressType="gz", targetDir=None): def uncompress(patchFile, compressType="gz", targetDir=None):
"""uncompresses a file and returns the path of the uncompressed """uncompresses a file and returns the path of the uncompressed