Skip to content

Commit c035b36

Browse files
committed
Enable specification of krb5-config via environment variable
1 parent 5e1accc commit c035b36

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

setup.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,19 @@ def get_output(*args, **kwargs):
3838

3939
# get the compile and link args
4040
kc = "krb5-config"
41+
autodetect_kc = True
4142
posix = os.name != 'nt'
4243

4344
# Per https://docs.python.org/3/library/platform.html#platform.architecture
4445
# this is the preferred way of determining "64-bitness".
4546
is64bit = sys.maxsize > 2**32
4647

48+
kc_env = 'KRB5CONFIG'
49+
if kc_env in os.environ:
50+
kc = os.environ[kc_env]
51+
autodetect_kc = False
52+
print(f"Using {kc} from env")
53+
4754
link_args, compile_args = [
4855
shlex.split(os.environ[e], posix=posix) if e in os.environ else None
4956
for e in ['GSSAPI_LINKER_ARGS', 'GSSAPI_COMPILER_ARGS']
@@ -77,7 +84,7 @@ def get_output(*args, **kwargs):
7784
except ValueError:
7885
cygwinccompiler.get_msvcr = lambda *a, **kw: []
7986

80-
if sys.platform.startswith("freebsd"):
87+
if sys.platform.startswith("freebsd") and autodetect_kc:
8188
# FreeBSD does $PATH backward, for our purposes. That is, the package
8289
# manager's version of the software is in /usr/local, which is in PATH
8390
# *after* the version in /usr. We prefer the package manager's version

0 commit comments

Comments
 (0)