Skip to content

Commit

Permalink
Fix setup.py to release based on git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
isi-adas committed Aug 16, 2024
1 parent 7dc2af2 commit 97aa704
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions localsetup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python
#
# Copyright (c) 2016-2020, Dell Inc. or its subsidiaries.
# All rights reserved.
# See file LICENSE for licensing information.
#
import ctypes
import os
import subprocess

try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError

_HERED = os.path.abspath(os.path.dirname(__file__))

val = subprocess.Popen("git describe", stdout=subprocess.PIPE, shell=True)
out, err = val.communicate()
tag = out.decode('utf-8').strip("\n")
try:
libgssapi_krb5 = ctypes.CDLL("libgssapi_krb5.so")
defines = [
("HAVE_GSS_SET_CRED_OPTION", hasattr(libgssapi_krb5, "gss_set_cred_option")),
(
"HAVE_GSSSPI_SET_CRED_OPTION",
hasattr(libgssapi_krb5, "gssspi_set_cred_option"),
),
]
lw_krb_module = Extension(
"pike.kerberos",
[
"pykerb/base64.c",
"pykerb/kerberosbasic.c",
"pykerb/kerberos.c",
"pykerb/kerberosgss.c",
"pykerb/kerberospw.c",
],
include_dirs=[os.path.join(_HERED, "pykerb", "vendor")],
libraries=["gssapi_krb5"],
define_macros=defines,
)
setup(ext_modules=[lw_krb_module], version=tag)
except (OSError, CCompilerError, DistutilsExecError, DistutilsPlatformError):
print("libgssapi_krb5 not available, skipping kerberos module")
setup(version=tag)

0 comments on commit 97aa704

Please sign in to comment.