Skip to content

Commit

Permalink
mrepo: use hashlib instead of sha on newer Python platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
zyv committed Jul 27, 2011
1 parent 37d7975 commit 33d7715
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mrepo
Expand Up @@ -21,7 +21,14 @@ import getopt
import glob
import os
import re
import sha

# Python >= 2.5
try:
from hashlib import sha1 as sha1hash
# Python <= 2.4
except ImportError:
from sha import new as sha1hash

import shutil
import sys
import time
Expand Down Expand Up @@ -1000,7 +1007,7 @@ def sha1dir(dir):
output = ''
for file in files:
output = output + os.path.basename(file) + ' ' + str(os.stat(file).st_size) + '\n'
return sha.new(output).hexdigest()
return sha1hash(output).hexdigest()

def writesha1(file, sha1sum=None):
"Write out sha1sum"
Expand Down

0 comments on commit 33d7715

Please sign in to comment.