Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f1c2e8

Browse files
asheshvfrozencemetery
authored andcommitted
Support 32-bit Windows if using 32-bit Python
Signed-off-by: Ashesh Vashi <ashesh.vashi@enterprisedb.com>[rharwood@redhat.com: commit message, squash, minor style tweaks]
1 parentdfbf05a commit4f1c2e8

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

‎gssapi/_win_config.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
importos
1010
importshutil
11+
importsys
1112
importctypes
1213

1314
#: Path to normal KfW installed bin folder
@@ -22,7 +23,10 @@
2223
defkfw_available():
2324
"""Return if the main GSSAPI DLL for KfW can be loaded"""
2425
try:# to load the main GSSAPI DLL
25-
ctypes.WinDLL('gssapi64.dll')
26+
ifsys.maxsize>2**32:
27+
ctypes.WinDLL('gssapi64.dll')
28+
else:
29+
ctypes.WinDLL('gssapi32.dll')
2630
exceptOSError:# DLL is not in PATH
2731
returnFalse
2832
else:# DLL is in PATH, everything should work

‎setup.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def get_output(*args, **kwargs):
3939
# get the compile and link args
4040
kc="krb5-config"
4141
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+
4247
link_args,compile_args= [
4348
shlex.split(os.environ[e],posix=posix)ifeinos.environelseNone
4449
forein ['GSSAPI_LINKER_ARGS','GSSAPI_COMPILER_ARGS']
@@ -97,7 +102,7 @@ def get_output(*args, **kwargs):
97102
link_args= ['-framework','GSS']
98103
elifwinkrb_path:
99104
_libs=os.path.join(
100-
winkrb_path,'lib','amd64'ifsys.maxsize>2**32else'i386'
105+
winkrb_path,'lib','amd64'ifis64bitelse'i386'
101106
)
102107
link_args= (
103108
['-L%s'%_libs]
@@ -114,8 +119,9 @@ def get_output(*args, **kwargs):
114119
elifwinkrb_path:
115120
compile_args= [
116121
'-I%s'%os.path.join(winkrb_path,'include'),
117-
'-DMS_WIN64'
118122
]
123+
ifis64bit:
124+
compile_args.append('-DMS_WIN64')
119125
elifos.environ.get('MINGW_PREFIX'):
120126
compile_args= ['-fPIC']
121127
else:
@@ -174,10 +180,7 @@ def get_output(*args, **kwargs):
174180
main_lib=os.environ.get('MINGW_PREFIX')+'/bin/libgss-3.dll'
175181
elifsys.platform=='msys':
176182
# 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-
% (64ifsys.maxsize>2**32else32)
180-
)
183+
_main_lib=f'/mingw{64ifis64bitelse32}/bin/libgss-3.dll'
181184
ifos.path.exists(_main_lib):
182185
main_lib=_main_lib
183186
os.environ['PATH']+=os.pathsep+os.path.dirname(main_lib)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp