Merge branch 'bugfix/idf_tools_py_splittype_deprecation' into 'master'

idf_tools.py: avoid splittype call deprecated in python3.8

Closes IDFGH-4364

See merge request espressif/esp-idf!11956
pull/6491/head
Ivan Grokhotkov 2021-01-20 07:24:36 +08:00
commit 19d2e4cca1
1 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -64,11 +64,10 @@ except ImportError:
pass
try:
from urllib.parse import splittype
from urllib.request import urlopen
from urllib.error import ContentTooShortError
except ImportError:
from urllib import urlopen, splittype, ContentTooShortError
from urllib import urlopen, ContentTooShortError
try:
from exceptions import WindowsError
@ -305,6 +304,14 @@ def unpack(filename, destination):
archive_obj.extractall(destination)
def splittype(url):
match = re.match('([^/:]+):(.*)', url, re.DOTALL)
if match:
scheme, data = match.groups()
return scheme.lower(), data
return None, url
# An alternative version of urlretrieve which takes SSL context as an argument
def urlretrieve_ctx(url, filename, reporthook=None, data=None, context=None):
url_type, path = splittype(url)