Retry ca certs download on macOS

This commit is contained in:
Kovid Goyal 2022-02-20 11:09:58 +05:30
parent d50a2ea288
commit f652b23169
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -185,7 +185,16 @@ class Freeze(object):
def add_ca_certs(self):
print('\nDownloading CA certs...')
from urllib.request import urlopen
cdata = urlopen(kitty_constants['cacerts_url']).read()
cdata = None
for i in range(5):
try:
cdata = urlopen(kitty_constants['cacerts_url']).read()
break
except Exception as e:
print(f'Downloading CA certs failed with error: {e}, retrying...')
if cdata is None:
raise SystemExit('Downloading C certs failed, giving up')
dest = join(self.contents_dir, 'Resources', 'cacert.pem')
with open(dest, 'wb') as f:
f.write(cdata)