1010import tarfile
1111import zipfile
1212from distutils import log
13- from distutils .version import StrictVersion as Version
1413from distutils .errors import DistutilsError
14+ from distutils .version import StrictVersion as Version
1515from pathlib import Path
1616from urllib .request import urlcleanup , urljoin , urlopen , urlretrieve
1717
@@ -59,33 +59,23 @@ def latest_release_from_gnome_org_cache(url, lib_name):
5959
6060
6161def latest_zlib_release ():
62- return latest_release_from_html (
63- 'https://zlib.net/fossils' , re .compile ('zlib-(?P<version>.*).tar.gz' )
64- )
62+ return latest_release_from_html ('https://zlib.net/fossils' , re .compile ('zlib-(?P<version>.*).tar.gz' ))
6563
6664
6765def latest_libiconv_release ():
68- return latest_release_from_html (
69- 'https://ftp.gnu.org/pub/gnu/libiconv' , re .compile ('libiconv-(?P<version>.*).tar.gz' )
70- )
66+ return latest_release_from_html ('https://ftp.gnu.org/pub/gnu/libiconv' , re .compile ('libiconv-(?P<version>.*).tar.gz' ))
7167
7268
7369def latest_libxml2_release ():
74- return latest_release_from_gnome_org_cache (
75- 'https://download.gnome.org/sources/libxml2' , 'libxml2'
76- )
70+ return latest_release_from_gnome_org_cache ('https://download.gnome.org/sources/libxml2' , 'libxml2' )
7771
7872
7973def latest_libxslt_release ():
80- return latest_release_from_gnome_org_cache (
81- 'https://download.gnome.org/sources/libxslt' , 'libxslt'
82- )
74+ return latest_release_from_gnome_org_cache ('https://download.gnome.org/sources/libxslt' , 'libxslt' )
8375
8476
8577def latest_xmlsec_release ():
86- return latest_release_from_html (
87- 'https://www.aleksey.com/xmlsec/download/' , re .compile ('xmlsec1-(?P<version>.*).tar.gz' )
88- )
78+ return latest_release_from_html ('https://www.aleksey.com/xmlsec/download/' , re .compile ('xmlsec1-(?P<version>.*).tar.gz' ))
8979
9080
9181class build_ext (build_ext_orig ):
@@ -265,7 +255,9 @@ def prepare_static_build_linux(self):
265255 self .info ('{:10}: {}' .format ('zlib' , 'PYXMLSEC_ZLIB_VERSION unset, downloading latest from {}' .format (url )))
266256 else :
267257 url = 'https://zlib.net/fossils/zlib-{}.tar.gz' .format (self .zlib_version )
268- self .info ('{:10}: {}' .format ('zlib' , 'PYXMLSEC_ZLIB_VERSION={}, downloading from {}' .format (self .zlib_version , url )))
258+ self .info (
259+ '{:10}: {}' .format ('zlib' , 'PYXMLSEC_ZLIB_VERSION={}, downloading from {}' .format (self .zlib_version , url ))
260+ )
269261 urlretrieve (url , str (zlib_tar ))
270262
271263 # fetch libiconv
@@ -278,7 +270,11 @@ def prepare_static_build_linux(self):
278270 self .info ('{:10}: {}' .format ('zlib' , 'PYXMLSEC_LIBICONV_VERSION unset, downloading latest from {}' .format (url )))
279271 else :
280272 url = 'https://ftp.gnu.org/pub/gnu/libiconv/libiconv-{}.tar.gz' .format (self .libiconv_version )
281- self .info ('{:10}: {}' .format ('zlib' , 'PYXMLSEC_LIBICONV_VERSION={}, downloading from {}' .format (self .libiconv_version , url )))
273+ self .info (
274+ '{:10}: {}' .format (
275+ 'zlib' , 'PYXMLSEC_LIBICONV_VERSION={}, downloading from {}' .format (self .libiconv_version , url )
276+ )
277+ )
282278 urlretrieve (url , str (libiconv_tar ))
283279
284280 # fetch libxml2
@@ -290,8 +286,14 @@ def prepare_static_build_linux(self):
290286 self .info ('{:10}: {}' .format ('libxml2' , 'PYXMLSEC_LIBXML2_VERSION unset, downloading latest from {}' .format (url )))
291287 else :
292288 version_prefix , _ = self .libxml2_version .split ('.' , - 1 )
293- url = 'https://download.gnome.org/sources/libxml2/{}/libxml2-{}.tar.xz' .format (version_prefix , self .libxml2_version )
294- self .info ('{:10}: {}' .format ('libxml2' , 'PYXMLSEC_LIBXML2_VERSION={}, downloading from {}' .format (self .libxml2_version , url )))
289+ url = 'https://download.gnome.org/sources/libxml2/{}/libxml2-{}.tar.xz' .format (
290+ version_prefix , self .libxml2_version
291+ )
292+ self .info (
293+ '{:10}: {}' .format (
294+ 'libxml2' , 'PYXMLSEC_LIBXML2_VERSION={}, downloading from {}' .format (self .libxml2_version , url )
295+ )
296+ )
295297 libxml2_tar = self .libs_dir / 'libxml2.tar.xz'
296298 urlretrieve (url , str (libxml2_tar ))
297299
@@ -304,8 +306,14 @@ def prepare_static_build_linux(self):
304306 self .info ('{:10}: {}' .format ('libxslt' , 'PYXMLSEC_LIBXSLT_VERSION unset, downloading latest from {}' .format (url )))
305307 else :
306308 version_prefix , _ = self .libxslt_version .split ('.' , - 1 )
307- url = 'https://download.gnome.org/sources/libxslt/{}/libxslt-{}.tar.xz' .format (version_prefix , self .libxslt_version )
308- self .info ('{:10}: {}' .format ('libxslt' , 'PYXMLSEC_LIBXSLT_VERSION={}, downloading from {}' .format (self .libxslt_version , url )))
309+ url = 'https://download.gnome.org/sources/libxslt/{}/libxslt-{}.tar.xz' .format (
310+ version_prefix , self .libxslt_version
311+ )
312+ self .info (
313+ '{:10}: {}' .format (
314+ 'libxslt' , 'PYXMLSEC_LIBXSLT_VERSION={}, downloading from {}' .format (self .libxslt_version , url )
315+ )
316+ )
309317 libxslt_tar = self .libs_dir / 'libxslt.tar.gz'
310318 urlretrieve (url , str (libxslt_tar ))
311319
@@ -318,7 +326,11 @@ def prepare_static_build_linux(self):
318326 self .info ('{:10}: {}' .format ('xmlsec1' , 'PYXMLSEC_XMLSEC1_VERSION unset, downloading latest from {}' .format (url )))
319327 else :
320328 url = 'https://www.aleksey.com/xmlsec/download/xmlsec1-{}.tar.gz' .format (self .xmlsec1_version )
321- self .info ('{:10}: {}' .format ('xmlsec1' , 'PYXMLSEC_XMLSEC1_VERSION={}, downloading from {}' .format (self .xmlsec1_version , url )))
329+ self .info (
330+ '{:10}: {}' .format (
331+ 'xmlsec1' , 'PYXMLSEC_XMLSEC1_VERSION={}, downloading from {}' .format (self .xmlsec1_version , url )
332+ )
333+ )
322334 xmlsec1_tar = self .libs_dir / 'xmlsec1.tar.gz'
323335 urlretrieve (url , str (xmlsec1_tar ))
324336
0 commit comments