-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix setup.py to release based on git tag
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |