Skip to content
Permalink
Browse files

build: use python3 to download external binaries (#21184)

* build: use python3 to download external binaries

* Update config.py
  • Loading branch information
MarshallOfSound authored and jkleinsc committed Nov 19, 2019
1 parent 73467f0 commit d34ba76eb6292ec6860cb02566b071e8fddbe0e1
Showing with 13 additions and 4 deletions.
  1. +1 −1 DEPS
  2. +1 −0 script/lib/config.py
  3. +11 −3 script/lib/util.py
2 DEPS
@@ -114,7 +114,7 @@ hooks = [
'pattern': 'src/electron/script/update-external-binaries.py',
'condition': 'download_external_binaries',
'action': [
'python',
'python3',
'src/electron/script/update-external-binaries.py',
],
},
@@ -21,6 +21,7 @@
PLATFORM = {
'cygwin': 'win32',
'darwin': 'darwin',
'linux': 'linux',
'linux2': 'linux',
'win32': 'win32',
}[sys.platform]
@@ -16,7 +16,11 @@
import sys
import tarfile
import tempfile
import urllib2
# Python 3 / 2 compat import
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
import zipfile

from lib.config import is_verbose_mode, PLATFORM
@@ -69,8 +73,12 @@ def download(text, url, path):
ssl._create_default_https_context = ssl._create_unverified_context

print("Downloading %s to %s" % (url, path))
web_file = urllib2.urlopen(url)
file_size = int(web_file.info().getheaders("Content-Length")[0])
web_file = urlopen(url)
info = web_file.info()
if hasattr(info, 'getheader'):
file_size = int(info.getheaders("Content-Length")[0])
else:
file_size = int(info.get("Content-Length")[0])
downloaded_size = 0
block_size = 4096

0 comments on commit d34ba76

Please sign in to comment.
You can’t perform that action at this time.