sha module is deprecated
This patch removes the deprecated warnings from the python
scripts.
Change-Id: I052a0aab3fb28dd1d78de1307edafda6b6c35e5f
diff --git a/tools/releasetools/check_target_files_signatures b/tools/releasetools/check_target_files_signatures
index 17aebdc..99bc801 100755
--- a/tools/releasetools/check_target_files_signatures
+++ b/tools/releasetools/check_target_files_signatures
@@ -47,12 +47,16 @@
import os
import re
-import sha
import shutil
import subprocess
import tempfile
import zipfile
+try:
+ from hashlib import sha1 as sha1
+except ImportError:
+ from sha import sha as sha1
+
import common
# Work around a bug in python's zipfile module that prevents opening
@@ -112,7 +116,7 @@
self.certs[cert] = self.certs[cert] + "," + name
else:
if name is None:
- name = "unknown cert %s (%s)" % (sha.sha(cert).hexdigest()[:12],
+ name = "unknown cert %s (%s)" % (sha1(cert).hexdigest()[:12],
GetCertSubject(cert))
self.certs[cert] = name