1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7
8 # build-system
9 cython,
10 setuptools,
11
12 # dependencies
13 decorator,
14
15 # native dependencies
16 krb5-c, # C krb5 library, not PyPI krb5
17
18 # tests
19 parameterized,
20 k5test,
21 pytestCheckHook,
22}:
23
24buildPythonPackage rec {
25 pname = "gssapi";
26 version = "1.9.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.6";
30
31 src = fetchFromGitHub {
32 owner = "pythongssapi";
33 repo = "python-${pname}";
34 tag = "v${version}";
35 hash = "sha256-Y53HoLcamoFIrwZtNcL1BOrzBjRD09mT3AiS0QUT7dY=";
36 };
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace 'get_output(f"{kc} gssapi --prefix")' '"${lib.getDev krb5-c}"'
41 '';
42
43 env = lib.optionalAttrs (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) {
44 GSSAPI_SUPPORT_DETECT = "false";
45 };
46
47 build-system = [
48 cython
49 krb5-c
50 setuptools
51 ];
52
53 dependencies = [ decorator ];
54
55 # k5test is marked as broken on darwin
56 doCheck = !stdenv.hostPlatform.isDarwin;
57
58 nativeCheckInputs = [
59 k5test
60 parameterized
61 pytestCheckHook
62 ];
63
64 preCheck = ''
65 mv gssapi/tests $TMPDIR/
66 pushd $TMPDIR
67 '';
68
69 postCheck = ''
70 popd
71 '';
72
73 pythonImportsCheck = [ "gssapi" ];
74
75 meta = with lib; {
76 homepage = "https://pypi.python.org/pypi/gssapi";
77 description = "Python GSSAPI Wrapper";
78 license = licenses.mit;
79 };
80}