@@ -39,6 +39,11 @@ def get_output(*args, **kwargs):
39
39
# get the compile and link args
40
40
kc = "krb5-config"
41
41
posix = os .name != 'nt'
42
+
43
+ # Per https://docs.python.org/3/library/platform.html#platform.architecture
44
+ # this is the preferred way of determining "64-bitness".
45
+ is64bit = sys .maxsize > 2 ** 32
46
+
42
47
link_args , compile_args = [
43
48
shlex .split (os .environ [e ], posix = posix ) if e in os .environ else None
44
49
for e in ['GSSAPI_LINKER_ARGS' , 'GSSAPI_COMPILER_ARGS' ]
@@ -97,7 +102,7 @@ def get_output(*args, **kwargs):
97
102
link_args = ['-framework' , 'GSS' ]
98
103
elif winkrb_path :
99
104
_libs = os .path .join (
100
- winkrb_path , 'lib' , 'amd64' if sys . maxsize > 2 ** 32 else 'i386'
105
+ winkrb_path , 'lib' , 'amd64' if is64bit else 'i386'
101
106
)
102
107
link_args = (
103
108
['-L%s' % _libs ]
@@ -114,8 +119,9 @@ def get_output(*args, **kwargs):
114
119
elif winkrb_path :
115
120
compile_args = [
116
121
'-I%s' % os .path .join (winkrb_path , 'include' ),
117
- '-DMS_WIN64'
118
122
]
123
+ if is64bit :
124
+ compile_args .append ('-DMS_WIN64' )
119
125
elif os .environ .get ('MINGW_PREFIX' ):
120
126
compile_args = ['-fPIC' ]
121
127
else :
@@ -174,10 +180,7 @@ def get_output(*args, **kwargs):
174
180
main_lib = os .environ .get ('MINGW_PREFIX' )+ '/bin/libgss-3.dll'
175
181
elif sys .platform == 'msys' :
176
182
# Plain msys, not running in MINGW_PREFIX. Try to get the lib from one
177
- _main_lib = (
178
- '/mingw%d/bin/libgss-3.dll'
179
- % (64 if sys .maxsize > 2 ** 32 else 32 )
180
- )
183
+ _main_lib = f'/mingw{ 64 if is64bit else 32 } /bin/libgss-3.dll'
181
184
if os .path .exists (_main_lib ):
182
185
main_lib = _main_lib
183
186
os .environ ['PATH' ] += os .pathsep + os .path .dirname (main_lib )
0 commit comments