File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import os
10
10
import shutil
11
+ import sys
11
12
import ctypes
12
13
13
14
#: Path to normal KfW installed bin folder
17
18
)
18
19
#: Download location for KfW
19
20
KFW_DL = "https://web.mit.edu/KERBEROS/dist"
21
+ is64bits = sys .maxsize > 2 ** 32
20
22
21
23
22
24
def kfw_available ():
23
25
"""Return if the main GSSAPI DLL for KfW can be loaded"""
24
26
try : # to load the main GSSAPI DLL
25
- ctypes .WinDLL ('gssapi64.dll' )
27
+ if is64bits is True :
28
+ ctypes .WinDLL ('gssapi64.dll' )
29
+ else :
30
+ ctypes .WinDLL ('gssapi32.dll' )
26
31
except OSError : # DLL is not in PATH
27
32
return False
28
33
else : # DLL is in PATH, everything should work
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ 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
+ # According to the Python documentation, in order to get the '64-bitness' of
44
+ # the current interpreter, it is more reliable to query the sys.maxsize
45
+ # attribute:
46
+ #
47
+ # Reference:
48
+ # https://docs.python.org/3/library/platform.html#platform.architecture
49
+ is64bits = sys .maxsize > 2 ** 32
42
50
link_args , compile_args = [
43
51
shlex .split (os .environ [e ], posix = posix ) if e in os .environ else None
44
52
for e in ['GSSAPI_LINKER_ARGS' , 'GSSAPI_COMPILER_ARGS' ]
@@ -114,8 +122,9 @@ def get_output(*args, **kwargs):
114
122
elif winkrb_path :
115
123
compile_args = [
116
124
'-I%s' % os .path .join (winkrb_path , 'include' ),
117
- '-DMS_WIN64'
118
125
]
126
+ if is64bits :
127
+ compile_args .push ('-DMS_WIN64' )
119
128
elif os .environ .get ('MINGW_PREFIX' ):
120
129
compile_args = ['-fPIC' ]
121
130
else :
You can’t perform that action at this time.
0 commit comments