Skip to content

Enable specification of krb5-config via environment variable #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ def get_output(*args, **kwargs):

# get the compile and link args
kc = "krb5-config"
autodetect_kc = True
posix = os.name != 'nt'

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

kc_env = 'GSSAPI_KRB5CONFIG'
if kc_env in os.environ:
kc = os.environ[kc_env]
autodetect_kc = False
print(f"Using {kc} from env")

link_args, compile_args = [
shlex.split(os.environ[e], posix=posix) if e in os.environ else None
for e in ['GSSAPI_LINKER_ARGS', 'GSSAPI_COMPILER_ARGS']
Expand Down Expand Up @@ -77,7 +84,7 @@ def get_output(*args, **kwargs):
except ValueError:
cygwinccompiler.get_msvcr = lambda *a, **kw: []

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