Reviewers: Søren Gjesse,
Message:
Søren,
may you have a look?
I resort to md5 if hashlib is missing as hashlib (hashlib was introduce in
2.5),
but could easily simplify the change.
Description:
Use hashlib module instead of md5 if it is present.
md5 module is deprecated since Python 2.5 and we'd better off using hashlib
instead.
Please review this at http://codereview.chromium.org/3026030/show
Affected files:
M tools/presubmit.py
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index
04952e0b4a232e3e9cc1f3c857cccd96d576b3ef..e69c9a85ac8e3ee033779c2f2847b3061abbf226
100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -27,8 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+try:
+ import hashlib
+ md5er = hashlib.md5
+except ImportError, e:
+ import md5
+ md5er = md5.new
+
-import md5
import optparse
import os
from os.path import abspath, join, dirname, basename, exists
@@ -126,7 +132,7 @@ class FileContentsCache(object):
for file in files:
try:
handle = open(file, "r")
- file_sum = md5.new(handle.read()).digest()
+ file_sum = md5er(handle.read()).digest()
if not file in self.sums or self.sums[file] != file_sum:
changed_or_new.append(file)
self.sums[file] = file_sum
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev