From c8f6e3fa055a40ba55af2ea3a2a7d5505a09f9d1 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 3 Jul 2018 16:24:19 +0530 Subject: cerbero: Don't try to use curl on Windows The curl that ships with the latest Windows 10 works fine, but people often have bad curl installations which can make bootstrap fail. Always Use urllib2 on Windows, and we should move to using it exclusively on all platforms. --- cerbero/hacks.py | 10 ++++++---- cerbero/utils/shell.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cerbero/hacks.py b/cerbero/hacks.py index 784a3807..fa28145d 100644 --- a/cerbero/hacks.py +++ b/cerbero/hacks.py @@ -169,12 +169,14 @@ shutil.rmtree = rmtree import cerbero.utils.shell # wget shipped with msys fails with an SSL error on github URLs # https://githubengineering.com/crypto-removal-notice/ -if not sys.platform.startswith('win') and cerbero.utils.shell.which('wget'): +# curl on Windows (if provided externally) is often badly-configured and fails +# to download over https, so just always use urllib2 on Windows. +if sys.platform.startswith('win'): + cerbero.utils.shell.download = cerbero.utils.shell.download_urllib2 +elif cerbero.utils.shell.which('wget'): cerbero.utils.shell.download = cerbero.utils.shell.download_wget elif cerbero.utils.shell.which('curl'): cerbero.utils.shell.download = cerbero.utils.shell.download_curl else: - # This is a very basic implementation, replace this with the requests - # module or something else when porting to Python 3. We can try to remove - # our dependency on wget/curl. + # Fallback. TODO: make this the default and remove curl/wget dependency cerbero.utils.shell.download = cerbero.utils.shell.download_urllib2 diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 15d896cc..c4139834 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -255,7 +255,7 @@ def download_wget(url, destination=None, recursive=False, check_cert=True, overw raise e -def download_urllib2(url, destination=None, recursive=False, check_cert=False, overwrite=False): +def download_urllib2(url, destination=None, recursive=False, check_cert=True, overwrite=False): ''' Download a file with urllib2, which does not rely on external programs -- cgit v1.2.3