diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-09-09 22:10:31 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-09-14 19:09:57 +0300 |
commit | 3d8876bf59ed20635cdc25de7a2da0d17210c944 (patch) | |
tree | 09522c22f508827b0358cdcc57655a4c8969e195 | |
parent | 49583ccfabcc3db057521bf2801f75f5bab94e0e (diff) | |
download | meson-3d8876bf59ed20635cdc25de7a2da0d17210c944.zip meson-3d8876bf59ed20635cdc25de7a2da0d17210c944.tar.gz meson-3d8876bf59ed20635cdc25de7a2da0d17210c944.tar.bz2 |
Download without status updates if server does not report file size. Closes #771.
-rw-r--r-- | mesonbuild/wrap/wrap.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index f03af67..16293e8 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -139,7 +139,13 @@ class Resolver: else: resp = urllib.request.urlopen(url) with contextlib.closing(resp) as resp: - dlsize = int(resp.info()['Content-Length']) + try: + dlsize = int(resp.info()['Content-Length']) + except TypeError: + dlsize = None + if dlsize is None: + print('Downloading file of unknown size.') + return resp.read() print('Download size:', dlsize) print('Downloading: ', end='') sys.stdout.flush() |