77import zipfile
88from distutils import log
99from distutils .errors import DistutilsError
10+ from pathlib import Path
11+ from urllib .request import urlcleanup , urljoin , urlretrieve
1012
1113from setuptools import Extension , setup
1214from setuptools .command .build_ext import build_ext as build_ext_orig
1315
14- if sys .version_info >= (3 , 4 ):
15- from urllib .request import urlcleanup , urljoin , urlretrieve
16- else :
17- from urllib import urlcleanup , urlretrieve
18- from urlparse import urljoin
19-
2016
2117class build_ext (build_ext_orig , object ):
2218 def info (self , message ):
2319 self .announce (message , level = log .INFO )
2420
2521 def run (self ):
26- if sys .version_info >= (3 , 4 ):
27- from pathlib import Path
28- else :
29- from pathlib2 import Path
30-
3122 ext = self .ext_map ['xmlsec' ]
3223 self .debug = os .environ .get ('PYXMLSEC_ENABLE_DEBUG' , False )
3324 self .static = os .environ .get ('PYXMLSEC_STATIC_DEPS' , False )
@@ -107,16 +98,10 @@ def run(self):
10798
10899 def prepare_static_build_win (self ):
109100 release_url = 'https://github.com/bgaifullin/libxml2-win-binaries/releases/download/v2018.08/'
110- if sys .version_info < (3 , 5 ):
111- if sys .maxsize > 2147483647 :
112- suffix = 'vs2008.win64'
113- else :
114- suffix = "vs2008.win32"
101+ if sys .maxsize > 2147483647 :
102+ suffix = 'win64'
115103 else :
116- if sys .maxsize > 2147483647 :
117- suffix = "win64"
118- else :
119- suffix = "win32"
104+ suffix = 'win32'
120105
121106 libs = [
122107 'libxml2-2.9.4.{}.zip' .format (suffix ),
@@ -185,7 +170,7 @@ def prepare_static_build_linux(self):
185170 self .libxml2_version = os .environ .get ('PYXMLSEC_LIBXML2_VERSION' , None )
186171 self .libxslt_version = os .environ .get ('PYXMLSEC_LIBXLST_VERSION' , None )
187172 self .zlib_version = os .environ .get ('PYXMLSEC_ZLIB_VERSION' , '1.2.11' )
188- self .xmlsec1_version = os .environ .get ('PYXMLSEC_XMLSEC1_VERSION' , '1.2.30 ' )
173+ self .xmlsec1_version = os .environ .get ('PYXMLSEC_XMLSEC1_VERSION' , '1.2.31 ' )
189174
190175 self .info ('Settings:' )
191176 self .info ('{:20} {}' .format ('Lib sources in:' , self .libs_dir .absolute ()))
@@ -402,26 +387,11 @@ def prepare_static_build_linux(self):
402387 ext .extra_objects = [str (self .prefix_dir / 'lib' / o ) for o in extra_objects ]
403388
404389
405- if sys .version_info >= (3 , 4 ):
406- from pathlib import Path
407-
408- src_root = Path (__file__ ).parent / 'src'
409- sources = [str (p .absolute ()) for p in src_root .rglob ('*.c' )]
410- else :
411- import fnmatch
412-
413- src_root = os .path .join (os .path .dirname (__file__ ), 'src' )
414- sources = []
415- for root , _ , files in os .walk (src_root ):
416- for file in fnmatch .filter (files , '*.c' ):
417- sources .append (os .path .join (root , file ))
418-
390+ src_root = Path (__file__ ).parent / 'src'
391+ sources = [str (p .absolute ()) for p in src_root .rglob ('*.c' )]
419392pyxmlsec = Extension ('xmlsec' , sources = sources )
420393setup_reqs = ['setuptools_scm[toml]>=3.4' , 'pkgconfig>=1.5.1' , 'lxml>=3.8' ]
421394
422- if sys .version_info < (3 , 4 ):
423- setup_reqs .append ('pathlib2' )
424-
425395
426396with io .open ('README.rst' , encoding = 'utf-8' ) as f :
427397 long_desc = f .read ()
@@ -434,15 +404,18 @@ def prepare_static_build_linux(self):
434404 long_description = long_desc ,
435405 ext_modules = [pyxmlsec ],
436406 cmdclass = {'build_ext' : build_ext },
437- python_requires = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* ' ,
407+ python_requires = '>=3.5 ' ,
438408 setup_requires = setup_reqs ,
439409 install_requires = ['lxml>=3.8' ],
440410 author = "Bulat Gaifullin" ,
441411442412 maintainer = 'Oleg Hoefling' ,
443413 maintainer_email = '[email protected] ' ,
444414 url = 'https://github.com/mehcode/python-xmlsec' ,
445- project_urls = {'Documentation' : 'https://xmlsec.readthedocs.io' , 'Source' : 'https://github.com/mehcode/python-xmlsec' ,},
415+ project_urls = {
416+ 'Documentation' : 'https://xmlsec.readthedocs.io' ,
417+ 'Source' : 'https://github.com/mehcode/python-xmlsec' ,
418+ },
446419 license = 'MIT' ,
447420 keywords = ['xmlsec' ],
448421 classifiers = [
@@ -452,12 +425,12 @@ def prepare_static_build_linux(self):
452425 'License :: OSI Approved :: MIT License' ,
453426 'Operating System :: OS Independent' ,
454427 'Programming Language :: C' ,
455- 'Programming Language :: Python :: 2.7' ,
456428 'Programming Language :: Python :: 3' ,
457429 'Programming Language :: Python :: 3.5' ,
458430 'Programming Language :: Python :: 3.6' ,
459431 'Programming Language :: Python :: 3.7' ,
460432 'Programming Language :: Python :: 3.8' ,
433+ 'Programming Language :: Python :: 3.9' ,
461434 'Topic :: Text Processing :: Markup :: XML' ,
462435 'Typing :: Typed' ,
463436 ],
0 commit comments