11import os
2- import sys
32import subprocess
3+ import sys
44
55
66# general use
77def get_output (* args , ** kwargs ):
88 res = subprocess .check_output (* args , shell = True , ** kwargs )
9- decoded = res .decode (' utf-8' )
9+ decoded = res .decode (" utf-8" )
1010 return decoded .strip ()
1111
1212
@@ -27,7 +27,7 @@ def import_gssapi_extension(name):
2727 """
2828
2929 try :
30- path = ' gssapi.raw.ext_{0}' .format (name )
30+ path = " gssapi.raw.ext_{0}" .format (name )
3131 __import__ (path )
3232 return sys .modules [path ]
3333 except ImportError :
@@ -44,33 +44,31 @@ def find_plugin_dir():
4444 return _PLUGIN_DIR
4545
4646 # if we've set a LD_LIBRARY_PATH, use that first
47- ld_path_raw = os .environ .get (' LD_LIBRARY_PATH' )
47+ ld_path_raw = os .environ .get (" LD_LIBRARY_PATH" )
4848 if ld_path_raw is not None :
4949 # first, try assuming it's just a normal install
5050
51- ld_paths = [path for path in ld_path_raw .split (':' ) if path ]
51+ ld_paths = [path for path in ld_path_raw .split (":" ) if path ]
5252
5353 for ld_path in ld_paths :
5454 if not os .path .exists (ld_path ):
5555 continue
5656
57- _PLUGIN_DIR = _decide_plugin_dir (
58- _find_plugin_dirs_installed (ld_path ))
57+ _PLUGIN_DIR = _decide_plugin_dir (_find_plugin_dirs_installed (ld_path ))
5958 if _PLUGIN_DIR is None :
60- _PLUGIN_DIR = _decide_plugin_dir (
61- _find_plugin_dirs_src (ld_path ))
59+ _PLUGIN_DIR = _decide_plugin_dir (_find_plugin_dirs_src (ld_path ))
6260
6361 if _PLUGIN_DIR is not None :
6462 break
6563
6664 # if there was no LD_LIBRARY_PATH, or the above failed
6765 if _PLUGIN_DIR is None :
68- lib_dir = os .path .join (get_output (' krb5-config --prefix' ), ' lib64' )
66+ lib_dir = os .path .join (get_output (" krb5-config --prefix" ), " lib64" )
6967 _PLUGIN_DIR = _decide_plugin_dir (_find_plugin_dirs_installed (lib_dir ))
7068
7169 # /usr/lib64 seems only to be distinct on Fedora/RHEL/Centos family
7270 if _PLUGIN_DIR is None :
73- lib_dir = os .path .join (get_output (' krb5-config --prefix' ), ' lib' )
71+ lib_dir = os .path .join (get_output (" krb5-config --prefix" ), " lib" )
7472 _PLUGIN_DIR = _decide_plugin_dir (_find_plugin_dirs_installed (lib_dir ))
7573
7674 if _PLUGIN_DIR is not None :
@@ -97,23 +95,25 @@ def _decide_plugin_dir(dirs):
9795
9896def _find_plugin_dirs_installed (search_path ):
9997 try :
100- options_raw = get_output ('find %s/ -type d \( ! -executable -o ! -readable \) '
101- '-prune -o '
102- '-type d -path "*/krb5/plugins" -print' % search_path ,
103- stderr = subprocess .STDOUT )
98+ options_raw = get_output (
99+ "find %s/ -type d \( ! -executable -o ! -readable \) "
100+ "-prune -o "
101+ '-type d -path "*/krb5/plugins" -print' % search_path ,
102+ stderr = subprocess .STDOUT ,
103+ )
104104 except subprocess .CalledProcessError :
105105 options_raw = None
106106
107107 if options_raw :
108- return options_raw .split (' \n ' )
108+ return options_raw .split (" \n " )
109109 else :
110110 return None
111111
112112
113113def _find_plugin_dirs_src (search_path ):
114- options_raw = get_output (' find %s/../ -type d -name plugins' % search_path )
114+ options_raw = get_output (" find %s/../ -type d -name plugins" % search_path )
115115
116116 if options_raw :
117- return options_raw .split (' \n ' )
117+ return options_raw .split (" \n " )
118118 else :
119119 return None
0 commit comments