1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pyasn1
6, pyasn1-modules
7, pythonAtLeast
8, pythonOlder
9, pytestCheckHook
10, openldap
11, cyrus_sasl
12}:
13
14buildPythonPackage rec {
15 pname = "python-ldap";
16 version = "3.4.3";
17 disabled = pythonOlder "3.6";
18
19 src = fetchFromGitHub {
20 owner = pname;
21 repo = pname;
22 rev = "refs/tags/python-ldap-${version}";
23 hash = "sha256-/ehvSs2qjuTPhaaOP0agPbWyyRugBpUlPq/Ny9t2C58=";
24 };
25
26 buildInputs = [
27 openldap
28 cyrus_sasl
29 ];
30
31 propagatedBuildInputs = [
32 pyasn1
33 pyasn1-modules
34 ];
35
36 checkInputs = [
37 pytestCheckHook
38 ];
39
40 preCheck = ''
41 # Needed by tests to setup a mockup ldap server.
42 export BIN="${openldap}/bin"
43 export SBIN="${openldap}/bin"
44 export SLAPD="${openldap}/libexec/slapd"
45 export SCHEMA="${openldap}/etc/schema"
46 '';
47
48 disabledTests = [
49 # https://github.com/python-ldap/python-ldap/issues/501
50 "test_tls_ext_noca"
51 ];
52
53 doCheck = !stdenv.isDarwin;
54
55 meta = with lib; {
56 description = "Python modules for implementing LDAP clients";
57 homepage = "https://www.python-ldap.org/";
58 license = licenses.psfl;
59 };
60}