7
7
import zipfile
8
8
from distutils import log
9
9
from distutils .errors import DistutilsError
10
+ from pathlib import Path
11
+ from urllib .request import urlcleanup , urljoin , urlretrieve
10
12
11
13
from setuptools import Extension , setup
12
14
from setuptools .command .build_ext import build_ext as build_ext_orig
13
15
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
-
20
16
21
17
class build_ext (build_ext_orig , object ):
22
18
def info (self , message ):
23
19
self .announce (message , level = log .INFO )
24
20
25
21
def run (self ):
26
- if sys .version_info >= (3 , 4 ):
27
- from pathlib import Path
28
- else :
29
- from pathlib2 import Path
30
-
31
22
ext = self .ext_map ['xmlsec' ]
32
23
self .debug = os .environ .get ('PYXMLSEC_ENABLE_DEBUG' , False )
33
24
self .static = os .environ .get ('PYXMLSEC_STATIC_DEPS' , False )
@@ -107,16 +98,10 @@ def run(self):
107
98
108
99
def prepare_static_build_win (self ):
109
100
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'
115
103
else :
116
- if sys .maxsize > 2147483647 :
117
- suffix = "win64"
118
- else :
119
- suffix = "win32"
104
+ suffix = 'win32'
120
105
121
106
libs = [
122
107
'libxml2-2.9.4.{}.zip' .format (suffix ),
@@ -185,7 +170,7 @@ def prepare_static_build_linux(self):
185
170
self .libxml2_version = os .environ .get ('PYXMLSEC_LIBXML2_VERSION' , None )
186
171
self .libxslt_version = os .environ .get ('PYXMLSEC_LIBXLST_VERSION' , None )
187
172
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 ' )
189
174
190
175
self .info ('Settings:' )
191
176
self .info ('{:20} {}' .format ('Lib sources in:' , self .libs_dir .absolute ()))
@@ -402,26 +387,11 @@ def prepare_static_build_linux(self):
402
387
ext .extra_objects = [str (self .prefix_dir / 'lib' / o ) for o in extra_objects ]
403
388
404
389
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' )]
419
392
pyxmlsec = Extension ('xmlsec' , sources = sources )
420
393
setup_reqs = ['setuptools_scm[toml]>=3.4' , 'pkgconfig>=1.5.1' , 'lxml>=3.8' ]
421
394
422
- if sys .version_info < (3 , 4 ):
423
- setup_reqs .append ('pathlib2' )
424
-
425
395
426
396
with io .open ('README.rst' , encoding = 'utf-8' ) as f :
427
397
long_desc = f .read ()
@@ -434,15 +404,18 @@ def prepare_static_build_linux(self):
434
404
long_description = long_desc ,
435
405
ext_modules = [pyxmlsec ],
436
406
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 ' ,
438
408
setup_requires = setup_reqs ,
439
409
install_requires = ['lxml>=3.8' ],
440
410
author = "Bulat Gaifullin" ,
441
411
442
412
maintainer = 'Oleg Hoefling' ,
443
413
maintainer_email = '[email protected] ' ,
444
414
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
+ },
446
419
license = 'MIT' ,
447
420
keywords = ['xmlsec' ],
448
421
classifiers = [
@@ -452,12 +425,12 @@ def prepare_static_build_linux(self):
452
425
'License :: OSI Approved :: MIT License' ,
453
426
'Operating System :: OS Independent' ,
454
427
'Programming Language :: C' ,
455
- 'Programming Language :: Python :: 2.7' ,
456
428
'Programming Language :: Python :: 3' ,
457
429
'Programming Language :: Python :: 3.5' ,
458
430
'Programming Language :: Python :: 3.6' ,
459
431
'Programming Language :: Python :: 3.7' ,
460
432
'Programming Language :: Python :: 3.8' ,
433
+ 'Programming Language :: Python :: 3.9' ,
461
434
'Topic :: Text Processing :: Markup :: XML' ,
462
435
'Typing :: Typed' ,
463
436
],
0 commit comments