summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-03 16:24:19 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-08-07 21:11:43 +0530
commitc8f6e3fa055a40ba55af2ea3a2a7d5505a09f9d1 (patch)
tree232fefb1a5d47305c0673b94b46d6f28c0b4fdec
parent438765f3632ee321db316dda848bf0b3dd598e84 (diff)
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.
-rw-r--r--cerbero/hacks.py10
-rw-r--r--cerbero/utils/shell.py2
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