#373 fixed..
This commit is contained in:
+14
-1
@@ -251,7 +251,8 @@ def get_file_hashes(top, exclude_prefix=None, remove_prefix=None):
|
|||||||
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) and not has_excluded_prefix(root):
|
if os.path.islink(root) and not has_excluded_prefix(root):
|
||||||
#yield the symlink..
|
#yield the symlink..
|
||||||
yield (root, sha1_file(root))
|
#bug 373
|
||||||
|
yield (root, sha1_data(os.readlink(root)))
|
||||||
exclude_prefix.append(remove_prefix(remove_prefix, root) + "/")
|
exclude_prefix.append(remove_prefix(remove_prefix, root) + "/")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -265,6 +266,9 @@ def get_file_hashes(top, exclude_prefix=None, remove_prefix=None):
|
|||||||
f = os.path.join(root, fname)
|
f = os.path.join(root, fname)
|
||||||
if has_excluded_prefix(f):
|
if has_excluded_prefix(f):
|
||||||
continue
|
continue
|
||||||
|
#bug 373
|
||||||
|
elif os.path.islink(f):
|
||||||
|
yield (f, sha1_data(os.readlink(f)))
|
||||||
else:
|
else:
|
||||||
yield (f, sha1_file(f))
|
yield (f, sha1_file(f))
|
||||||
|
|
||||||
@@ -291,6 +295,15 @@ def sha1_file(filename):
|
|||||||
except IOError:
|
except IOError:
|
||||||
return "0"
|
return "0"
|
||||||
|
|
||||||
|
def sha1_data(data):
|
||||||
|
"""calculate sha1 hash of given data"""
|
||||||
|
try:
|
||||||
|
m = sha.new()
|
||||||
|
m.update(data)
|
||||||
|
return m.hexdigest()
|
||||||
|
except:
|
||||||
|
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
|
||||||
file"""
|
file"""
|
||||||
|
|||||||
Reference in New Issue
Block a user