DeprecationWarning: the sha module is deprecated; use the hashlib module instead --- a/BitTorrent/ConvertedMetainfo.py +++ b/BitTorrent/ConvertedMetainfo.py @@ -15,7 +15,10 @@ from __future__ import generators import os import sys -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from BitTorrent.obsoletepythonsupport import * --- a/BitTorrent/NewVersion.py +++ b/BitTorrent/NewVersion.py @@ -15,7 +15,10 @@ import sys import zurllib import pickle import threading -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha DEBUG = False --- a/BitTorrent/PeerID.py +++ b/BitTorrent/PeerID.py @@ -11,7 +11,10 @@ # Written by Matt Chisholm import os -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from time import time try: getpid = os.getpid --- a/BitTorrent/StorageWrapper.py +++ b/BitTorrent/StorageWrapper.py @@ -12,7 +12,10 @@ from __future__ import division -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from array import array from binascii import b2a_hex --- a/BitTorrent/download.py +++ b/BitTorrent/download.py @@ -19,7 +19,10 @@ import sys import threading import errno import gc -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from socket import error as socketerror from random import seed from time import time --- a/BitTorrent/makemetafile.py +++ b/BitTorrent/makemetafile.py @@ -16,7 +16,10 @@ from __future__ import division import os import sys -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from time import time from threading import Event --- a/BitTorrent/parsedir.py +++ b/BitTorrent/parsedir.py @@ -11,7 +11,10 @@ # Written by John Hoffman and Uoti Urpala import os -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from BitTorrent.bencode import bencode, bdecode from BitTorrent.btformats import check_message --- a/khashmir/khash.py +++ b/khashmir/khash.py @@ -8,7 +8,10 @@ # for the specific language governing rights and limitations under the # License. -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from random import randint #this is ugly, hopefully os.entropy will be in 2.4 --- a/khashmir/khashmir.py +++ b/khashmir/khashmir.py @@ -13,7 +13,10 @@ from socket import gethostbyname from BitTorrent.platform import bttime as time -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha import re from BitTorrent.defaultargs import common_options, rare_options from BitTorrent.RawServer_magic import RawServer --- a/khashmir/utkhashmir.py +++ b/khashmir/utkhashmir.py @@ -13,7 +13,10 @@ from actions import * from khash import newID from krpc import KRPCProtocolError, KRPCFailSilently from cache import Cache -from sha import sha +try: + from hashlib import sha1 as sha +except ImportError: + from sha import sha from util import * from threading import Thread from socket import gethostbyname