@@ -106,6 +106,16 @@ def latest_xmlsec_release():
106106 return tar_gz ['browser_download_url' ]
107107
108108
109+ def urlretrieve2 (url , filename ):
110+ req = Request (url , headers = {'User-Agent' : 'python-xmlsec build' })
111+ with urlopen (req ) as r , open (filename , 'wb' ) as f :
112+ while True :
113+ chunk = r .read (8192 )
114+ if not chunk :
115+ break
116+ f .write (chunk )
117+
118+
109119class CrossCompileInfo :
110120 def __init__ (self , host , arch , compiler ):
111121 self .host = host
@@ -319,13 +329,13 @@ def prepare_static_build(self, build_platform):
319329 libiconv_tar = self .libs_dir / 'libiconv.tar.gz'
320330 if self .libiconv_version is None :
321331 url = latest_libiconv_release ()
322- self .info ('{:10}: {}' .format ('zlib ' , f'PYXMLSEC_LIBICONV_VERSION unset, downloading latest from { url } ' ))
332+ self .info ('{:10}: {}' .format ('libiconv ' , f'PYXMLSEC_LIBICONV_VERSION unset, downloading latest from { url } ' ))
323333 else :
324334 url = f'https://ftp.gnu.org/pub/gnu/libiconv/libiconv-{ self .libiconv_version } .tar.gz'
325335 self .info (
326- '{:10}: {}' .format ('zlib ' , f'PYXMLSEC_LIBICONV_VERSION={ self .libiconv_version } , downloading from { url } ' )
336+ '{:10}: {}' .format ('libiconv ' , f'PYXMLSEC_LIBICONV_VERSION={ self .libiconv_version } , downloading from { url } ' )
327337 )
328- urlretrieve (url , str (libiconv_tar ))
338+ urlretrieve2 (url , str (libiconv_tar ))
329339
330340 # fetch libxml2
331341 libxml2_tar = next (self .libs_dir .glob ('libxml2*.tar.xz' ), None )
0 commit comments