mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
idf_tools.py: avoid splittype call deprecated in python3.8
Closes https://github.com/espressif/esp-idf/issues/6200
This commit is contained in:
@@ -64,11 +64,10 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.parse import splittype
|
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from urllib.error import ContentTooShortError
|
from urllib.error import ContentTooShortError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urllib import urlopen, splittype, ContentTooShortError
|
from urllib import urlopen, ContentTooShortError
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from exceptions import WindowsError
|
from exceptions import WindowsError
|
||||||
@@ -305,6 +304,14 @@ def unpack(filename, destination):
|
|||||||
archive_obj.extractall(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
|
# An alternative version of urlretrieve which takes SSL context as an argument
|
||||||
def urlretrieve_ctx(url, filename, reporthook=None, data=None, context=None):
|
def urlretrieve_ctx(url, filename, reporthook=None, data=None, context=None):
|
||||||
url_type, path = splittype(url)
|
url_type, path = splittype(url)
|
||||||
|
Reference in New Issue
Block a user