1
1
#!/usr/bin/env python
2
- from setuptools import setup , Feature
2
+ from setuptools import setup , Feature # noqa
3
3
from setuptools .extension import Extension
4
4
from Cython .Distutils import build_ext
5
- import sys
5
+ import sys # noqa
6
6
import re
7
7
import os
8
8
13
13
get_output = commands .getoutput
14
14
except ImportError :
15
15
import subprocess
16
+
16
17
def _get_output (* args , ** kwargs ):
17
18
res = subprocess .check_output (* args , shell = True , ** kwargs )
18
19
decoded = res .decode ('utf-8' )
@@ -33,7 +34,8 @@ def _get_output(*args, **kwargs):
33
34
link_args = link_args .split ()
34
35
compile_args = compile_args .split ()
35
36
36
- ENABLE_SUPPORT_DETECTION = (os .environ .get ('GSSAPI_SUPPORT_DETECT' , 'true' ).lower () == 'true' )
37
+ ENABLE_SUPPORT_DETECTION = \
38
+ (os .environ .get ('GSSAPI_SUPPORT_DETECT' , 'true' ).lower () == 'true' )
37
39
38
40
if ENABLE_SUPPORT_DETECTION :
39
41
main_lib = os .environ .get ('GSSAPI_MAIN_LIB' , None )
@@ -70,26 +72,29 @@ def run(self):
70
72
header .write ('#include "gssapi.h"' )
71
73
72
74
for ext in self .extensions :
73
- ext .extra_compile_args .append ("-I%s" % os .path .abspath (target_dir ))
75
+ ext .extra_compile_args .append ("-I%s" %
76
+ os .path .abspath (target_dir ))
74
77
75
78
build_ext .run (self )
76
79
77
- # detect support
78
80
81
+ # detect support
79
82
def main_file (module ):
80
83
return Extension ('gssapi.raw.%s' % module ,
81
- extra_link_args = link_args ,
82
- extra_compile_args = compile_args ,
83
- sources = ['gssapi/raw/%s.pyx' % module ])
84
+ extra_link_args = link_args ,
85
+ extra_compile_args = compile_args ,
86
+ sources = ['gssapi/raw/%s.pyx' % module ])
87
+
84
88
85
89
def extension_file (module , canary ):
86
90
if ENABLE_SUPPORT_DETECTION and not hasattr (GSSAPI_LIB , canary ):
87
91
return None
88
92
else :
89
93
return Extension ('gssapi.raw.ext_%s' % module ,
90
- extra_link_args = link_args ,
91
- extra_compile_args = compile_args ,
92
- sources = ['gssapi/raw/ext_%s.pyx' % module ])
94
+ extra_link_args = link_args ,
95
+ extra_compile_args = compile_args ,
96
+ sources = ['gssapi/raw/ext_%s.pyx' % module ])
97
+
93
98
94
99
def gssapi_modules (lst ):
95
100
# filter out missing files
@@ -99,9 +104,9 @@ def gssapi_modules(lst):
99
104
MECHS_SUPPORTED = os .environ .get ('GSSAPI_MECHS' , 'krb5' ).split (',' )
100
105
for mech in MECHS_SUPPORTED :
101
106
res .append (Extension ('gssapi.raw.mech_%s' % mech ,
102
- extra_link_args = link_args ,
103
- extra_compile_args = compile_args ,
104
- sources = ['gssapi/raw/mech_%s.pyx' % mech ]))
107
+ extra_link_args = link_args ,
108
+ extra_compile_args = compile_args ,
109
+ sources = ['gssapi/raw/mech_%s.pyx' % mech ]))
105
110
106
111
return res
107
112
@@ -132,8 +137,8 @@ def gssapi_modules(lst):
132
137
'Topic :: Security' ,
133
138
'Topic :: Software Development :: Libraries :: Python Modules'
134
139
],
135
- cmdclass = {'build_ext' : build_gssapi_ext },
136
- ext_modules = gssapi_modules ([
140
+ cmdclass = {'build_ext' : build_gssapi_ext },
141
+ ext_modules = gssapi_modules ([
137
142
main_file ('misc' ),
138
143
main_file ('exceptions' ),
139
144
main_file ('creds' ),
0 commit comments