1{ stdenv
2, lib
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6, six
7, decorator
8, nose
9, krb5Full
10, GSS
11, parameterized
12, shouldbe
13, cython
14, python
15, k5test
16}:
17
18buildPythonPackage rec {
19 pname = "gssapi";
20 version = "1.7.3";
21 disabled = pythonOlder "3.6";
22
23 src = fetchFromGitHub {
24 owner = "pythongssapi";
25 repo = "python-${pname}";
26 rev = "v${version}";
27 sha256 = "sha256-/1YOnG6sCP8G8J3K2/RycTC95rXW9M+U3Mjz4GCt13s=";
28 };
29
30 # It's used to locate headers
31 postPatch = ''
32 substituteInPlace setup.py \
33 --replace 'get_output(f"{kc} gssapi --prefix")' '"${lib.getDev krb5Full}"'
34 '';
35
36 nativeBuildInputs = [
37 cython
38 krb5Full
39 ];
40
41 propagatedBuildInputs = [
42 decorator
43 six
44 ];
45
46 buildInputs = lib.optionals stdenv.isDarwin [
47 GSS
48 ];
49
50 checkInputs = [
51 k5test
52 nose
53 parameterized
54 shouldbe
55 six
56 ];
57
58 doCheck = pythonOlder "3.8" # `shouldbe` not available
59 && !stdenv.isDarwin; # many failures on darwin
60
61 # skip tests which fail possibly due to be an upstream issue (see
62 # https://github.com/pythongssapi/python-gssapi/issues/220)
63 checkPhase = ''
64 # some tests don't respond to being disabled through nosetests -x
65 echo $'\ndel CredsTestCase.test_add_with_impersonate' >> gssapi/tests/test_high_level.py
66 echo $'\ndel TestBaseUtilities.test_acquire_creds_impersonate_name' >> gssapi/tests/test_raw.py
67 echo $'\ndel TestBaseUtilities.test_add_cred_impersonate_name' >> gssapi/tests/test_raw.py
68
69 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
70 nosetests -e 'ext_test_\d.*'
71 '';
72 pythonImportsCheck = [ "gssapi" ];
73
74 meta = with lib; {
75 homepage = "https://pypi.python.org/pypi/gssapi";
76 description = "Python GSSAPI Wrapper";
77 license = licenses.mit;
78 };
79}