From 39cc8a649b153c63b0dbcb7308e34d441ec923fd Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Tue, 25 May 2021 21:35:00 +0530 Subject: [PATCH] Use of a variable only when required. Also - fixed an issue related using 'append' instead of 'push' on a list Signed-off-by: Ashesh Vashi --- gssapi/_win_config.py | 3 +-- setup.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gssapi/_win_config.py b/gssapi/_win_config.py index c3147fcb..9b765b20 100644 --- a/gssapi/_win_config.py +++ b/gssapi/_win_config.py @@ -18,13 +18,12 @@ ) #: Download location for KfW KFW_DL = "https://web.mit.edu/KERBEROS/dist" -is64bits = sys.maxsize > 2**32 def kfw_available(): """Return if the main GSSAPI DLL for KfW can be loaded""" try: # to load the main GSSAPI DLL - if is64bits is True: + if sys.maxsize > 2**32: ctypes.WinDLL('gssapi64.dll') else: ctypes.WinDLL('gssapi32.dll') diff --git a/setup.py b/setup.py index c4df3364..37e38446 100755 --- a/setup.py +++ b/setup.py @@ -105,7 +105,7 @@ def get_output(*args, **kwargs): link_args = ['-framework', 'GSS'] elif winkrb_path: _libs = os.path.join( - winkrb_path, 'lib', 'amd64' if sys.maxsize > 2 ** 32 else 'i386' + winkrb_path, 'lib', 'amd64' if is64bits else 'i386' ) link_args = ( ['-L%s' % _libs] @@ -124,7 +124,7 @@ def get_output(*args, **kwargs): '-I%s' % os.path.join(winkrb_path, 'include'), ] if is64bits: - compile_args.push('-DMS_WIN64') + compile_args.append('-DMS_WIN64') elif os.environ.get('MINGW_PREFIX'): compile_args = ['-fPIC'] else: @@ -185,7 +185,7 @@ def get_output(*args, **kwargs): # Plain msys, not running in MINGW_PREFIX. Try to get the lib from one _main_lib = ( '/mingw%d/bin/libgss-3.dll' - % (64 if sys.maxsize > 2 ** 32 else 32) + % (64 if is64bits else 32) ) if os.path.exists(_main_lib): main_lib = _main_lib